Validate an extraction schema
const url = 'http://127.0.0.1:8000/v1/schemas/validate';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"schema":{"additionalProperties":false,"properties":{"invoice_number":{"type":["string","null"],"x-parsehawk":{"semantic":"verbatim-string"}},"total":{"type":"number"},"currency":{"type":"string","x-parsehawk":{"semantic":"currency"}}},"required":["invoice_number","total","currency"],"type":"object"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://127.0.0.1:8000/v1/schemas/validate \ --header 'Content-Type: application/json' \ --data '{ "schema": { "additionalProperties": false, "properties": { "invoice_number": { "type": [ "string", "null" ], "x-parsehawk": { "semantic": "verbatim-string" } }, "total": { "type": "number" }, "currency": { "type": "string", "x-parsehawk": { "semantic": "currency" } } }, "required": [ "invoice_number", "total", "currency" ], "type": "object" } }'Check a JSON Schema against the ParseHawk authoring dialect and return its canonical form plus machine-readable diagnostics.
ParseHawk extraction schema dialect
Request Bodyrequired
Section titled “Request Bodyrequired”Request to validate a ParseHawk extraction schema.
object
ParseHawk extraction schema. This is the public authoring dialect documented in docs/schemas/parsehawk-extraction-schema.schema.json.
object
Responses
Section titled “Responses”Successful Response
Validation result and canonical schema when accepted.
object
Whether the schema is accepted by ParseHawk.
Non-blocking diagnostics.
One machine-readable schema validation diagnostic.
object
Human-readable diagnostic message.
JSONPath-like location in the submitted schema.
Stable diagnostic code.
Blocking diagnostics that make the schema invalid.
One machine-readable schema validation diagnostic.
object
Human-readable diagnostic message.
JSONPath-like location in the submitted schema.
Stable diagnostic code.
Example
{ "warnings": [ { "path": "$", "code": "unsupported_keyword" } ], "errors": [ { "path": "$", "code": "unsupported_keyword" } ]}The request or domain input failed validation.
Error returned by request validation or a ParseHawk domain service.
object
object
Examplegenerated
{ "detail": [ {} ]}Unexpected server error.
Error returned by request validation or a ParseHawk domain service.
object
object
Examplegenerated
{ "detail": [ {} ]}