Provider interface for creating validators from JSON Schemas
This is the main extension point for custom validator implementations. Implementations should:
class MyValidatorProvider implements jsonSchemaValidator { getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T> { // Compile/cache validator from schema return (input: unknown) => isValid(schema, input) ? { valid: true, data: input as T, errorMessage: undefined } : { valid: false, data: undefined, errorMessage: 'Error details' }; }} Copy
class MyValidatorProvider implements jsonSchemaValidator { getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T> { // Compile/cache validator from schema return (input: unknown) => isValid(schema, input) ? { valid: true, data: input as T, errorMessage: undefined } : { valid: false, data: undefined, errorMessage: 'Error details' }; }}
Create a validator for the given JSON Schema
Standard JSON Schema object
A validator function that can be called multiple times
Provider interface for creating validators from JSON Schemas
This is the main extension point for custom validator implementations. Implementations should:
Example