Validate a JSON schema and an optional payload against it
const url = 'https://app.prefactorai.com/api/v1/utils/validate_schema';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”JSON Schema draft 2020-12 document to validate. Prefactor payload schemas require a root type of object, or object and null.
object
Responses
Section titled “Responses”Success
object
Problems found; empty when valid is true
A problem at a field path found by a schema, payload or marker check
object
Field path with the problem
Description of the problem
True when the schema and optional payload pass the checks
Example
{ "problems": [], "status": "success", "valid": true}default
Section titled “default”Error
object
object
object
object
Milliseconds until the client may retry.
object
A valid knowledgebase document revision ID
Example
{ "code": "bad_request", "status": "error"}