github.com/smintz/nomad@v0.8.3/website/source/api/validate.html.md (about)

     1  ---
     2  layout: api
     3  page_title: Validate - HTTP API
     4  sidebar_current: api-validate
     5  description: |-
     6    The /validate endpoints are used to validate object structs, fields, and
     7    types.
     8  ---
     9  
    10  # Validate HTTP API
    11  
    12  The `/validate` endpoints are used to validate object structs, fields, and
    13  types.
    14  
    15  ## Validate Job
    16  
    17  This endpoint validates a Nomad job file. The local Nomad agent forwards the
    18  request to a server. In the event a server can't be reached the agent verifies
    19  the job file locally but skips validating driver configurations.
    20  
    21  ~> This endpoint accepts a **JSON job file**, not an HCL job file.
    22  
    23  | Method  | Path                      | Produces                   |
    24  | ------- | ------------------------- | -------------------------- |
    25  | `POST`  | `/v1/validate/job`        | `application/json`         |
    26  
    27  The table below shows this endpoint's support for
    28  [blocking queries](/api/index.html#blocking-queries) and
    29  [required ACLs](/api/index.html#acls).
    30  
    31  | Blocking Queries | ACL Required               |
    32  | ---------------- | -------------------------- |
    33  | `NO`             | `namespace:read-job`       |
    34  
    35  ### Parameters
    36  
    37  There are no parameters, but the request _body_ contains the entire job file.
    38  
    39  ### Sample Payload
    40  
    41  ```text
    42  (any valid nomad job IN JSON FORMAT)
    43  ```
    44  
    45  ### Sample Request
    46  
    47  ```text
    48  $ curl \
    49      --request POST \
    50      --data @my-job.nomad \
    51      https://localhost:4646/v1/validate/job
    52  ```
    53  
    54  ### Sample Response
    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  ```