Skip to content

Validate a JSON schema and an optional payload against it

POST
/api/v1/utils/validate_schema
curl --request POST \
--url https://app.prefactorai.com/api/v1/utils/validate_schema \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'

Prefactor uses JSON Schema draft 2020-12 (https://json-schema.org/draft/2020-12/schema) for payload schemas across the product and for this util. Checks that the schema is a valid Prefactor payload schema: a draft 2020-12 document whose root type is object, or object and null. When payload is sent, also checks that value against the schema. Does not create resources.

JSON Schema draft 2020-12 document to validate. Prefactor payload schemas require a root type of object, or object and null.

object
key
additional properties
any

Success

Media typeapplication/json
object
problems
required

Problems found; empty when valid is true

Array<object>
UtilsFieldProblem

A problem at a field path found by a schema, payload or marker check

object
field
required

Field path with the problem

string
message
required

Description of the problem

string
status
required
string
Allowed values: success
valid
required

True when the schema and optional payload pass the checks

boolean
Example
{
"problems": [],
"status": "success",
"valid": true
}

Error

Media typeapplication/json
One of:
object
code
required
string
Allowed values: bad_request bad_authtoken not_authenticated not_permitted not_implemented unknown not_found unexpected_ref_type unexpected invalid_action invalid_state alert_unknown alert_already_cleared invalid_value required_value idempotency_key_already_used temporarily_unavailable conflict
message
required
string
status
required
string
Allowed values: error
Example
{
"code": "bad_request",
"status": "error"
}