github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/api-docs/validate.mdx (about)

     1  ---
     2  layout: api
     3  page_title: Validate - HTTP API
     4  description: |-
     5    The /validate endpoints are used to validate object structs, fields, and
     6    types.
     7  ---
     8  
     9  # Validate HTTP API
    10  
    11  The `/validate` endpoints are used to validate object structs, fields, and
    12  types.
    13  
    14  ## Validate Job
    15  
    16  This endpoint validates a Nomad job file. The local Nomad agent forwards the
    17  request to the leader. In the event the leader cannot be reached the agent verifies
    18  the job file locally but skips validating driver configurations.
    19  
    20  ~> This endpoint accepts a **JSON job file**, not an HCL job file.
    21  
    22  | Method | Path               | Produces           |
    23  | ------ | ------------------ | ------------------ |
    24  | `POST` | `/v1/validate/job` | `application/json` |
    25  
    26  The table below shows this endpoint's support for
    27  [blocking queries](/api-docs#blocking-queries) and
    28  [required ACLs](/api-docs#acls).
    29  
    30  | Blocking Queries | ACL Required         |
    31  | ---------------- | -------------------- |
    32  | `NO`             | `namespace:read-job` |
    33  
    34  ### Parameters
    35  
    36  There are no parameters, but the request _body_ contains the entire job file.
    37  
    38  ### Sample Payload
    39  
    40  ```text
    41  (any valid nomad job IN JSON FORMAT)
    42  ```
    43  
    44  ### Sample Request
    45  
    46  ```shell-session
    47  $ curl \
    48      --request POST \
    49      --data @my-job.nomad \
    50      https://localhost:4646/v1/validate/job
    51  ```
    52  
    53  ### Sample Response
    54  
    55  ```json
    56  {
    57    "DriverConfigValidated": true,
    58    "ValidationErrors": [
    59      "Task group cache validation failed: 1 error(s) occurred:\n\n* Task redis validation failed: 1 error(s) occurred:\n\n* 1 error(s) occurred:\n\n* minimum CPU value is 20; got 1"
    60    ],
    61    "Warnings": "1 warning(s):\n\n* Group \"cache\" has warnings: 1 error(s) occurred:\n\n* Update max parallel count is greater than task group count (13 > 1). A destructive change would result in the simultaneous replacement of all allocations.",
    62    "Error": "1 error(s) occurred:\n\n* Task group cache validation failed: 1 error(s) occurred:\n\n* Task redis validation failed: 1 error(s) occurred:\n\n* 1 error(s) occurred:\n\n* minimum CPU value is 20; got 1"
    63  }
    64  ```