Skip to content

Validate an extraction schema

POST
/v1/schemas/validate
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

Media typeapplication/json
ValidateSchemaRequest

Request to validate a ParseHawk extraction schema.

object
schema
required
Schema

ParseHawk extraction schema. This is the public authoring dialect documented in docs/schemas/parsehawk-extraction-schema.schema.json.

object
key
additional properties
any

Successful Response

Media typeapplication/json
ValidateSchemaResponse

Validation result and canonical schema when accepted.

object
valid
required
Valid

Whether the schema is accepted by ParseHawk.

boolean
schema
Any of:
object
key
additional properties
any
warnings
Warnings

Non-blocking diagnostics.

Array<object>
SchemaDiagnostic

One machine-readable schema validation diagnostic.

object
message
required
Message

Human-readable diagnostic message.

string
path
Path

JSONPath-like location in the submitted schema.

string
default: $
code
required
Code

Stable diagnostic code.

string
errors
Errors

Blocking diagnostics that make the schema invalid.

Array<object>
SchemaDiagnostic

One machine-readable schema validation diagnostic.

object
message
required
Message

Human-readable diagnostic message.

string
path
Path

JSONPath-like location in the submitted schema.

string
default: $
code
required
Code

Stable diagnostic code.

string
Example
{
"warnings": [
{
"path": "$",
"code": "unsupported_keyword"
}
],
"errors": [
{
"path": "$",
"code": "unsupported_keyword"
}
]
}

The request or domain input failed validation.

Media typeapplication/json
ApiErrorResponse

Error returned by request validation or a ParseHawk domain service.

object
detail
required
Any of:
string
Examplegenerated
{
"detail": [
{}
]
}

Unexpected server error.

Media typeapplication/json
ApiErrorResponse

Error returned by request validation or a ParseHawk domain service.

object
detail
required
Any of:
string
Examplegenerated
{
"detail": [
{}
]
}