Skip to main content
Version: 1.2.1-beta1.0

Function: validateJsonSchema()

validateJsonSchema(value, schema, path?): JsonSchemaValidationError[]

Defined in: src/Mnemonic/json-schema.ts:541

Validates a value against a JsonSchema.

Returns an empty array when the value is valid. Returns one or more JsonSchemaValidationError entries on failure. Short-circuits on type mismatch (does not report downstream keyword errors).

Parameters

ParameterTypeDefault valueDescription
valueunknownundefinedThe value to validate
schemaJsonSchemaundefinedThe JSON Schema to validate against
pathstring""Internal: JSON Pointer path for error reporting (default: "")

Returns

JsonSchemaValidationError[]

Array of validation errors (empty = valid)