workspaces

POST /workspaces/{workspace}/policies/validate/

Changed on

Check that a Rego policy compiles, without creating or updating anything. Use this to catch syntax and type errors while authoring a policy, before submitting it to the create or update endpoints, which apply the same check.

Returns is_valid, plus a findings list describing each problem with a code, a message and, where known, the line it occurs on. A policy is valid when findings contains nothing of severity error. The submitted Rego is not stored.

Request

  • Base URL
    https://api.cloudsmith.io/v2
  • Auth
    • API key in header X-Api-Key
    • or HTTP basic

Path parameters

workspacestring required

The name of the Workspace.

Request body

regostring required

The Rego policy source to validate. Maximum 256 KB. Not persisted.

Response

is_validboolean required

True when no finding has severity 'error'.

rawstring required

Full raw OPA output; empty when the policy is valid.

Changes

    • info

      api operation id workspaces_policies_validate_create removed and replaced with workspaces_policies_validate

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      endpoint added