Skip to main content

JsonValidator Interface

JSON schema validator compliant with draft 6 schema. See https://json-schema.org.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/tree/alpha.

For more information about our API support guarantees, see here.

Signature

export interface JsonValidator

Methods

Method Alerts Return Type Description
compile(schema) Alpha SchemaValidationFunction<Schema> Compiles the provided JSON schema into a validator for that schema.

Method Details

compile

Compiles the provided JSON schema into a validator for that schema.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/tree/alpha.

For more information about our API support guarantees, see here.

Signature

compile<Schema extends TSchema>(schema: Schema): SchemaValidationFunction<Schema>;
Type Parameters
Parameter Constraint Description
Schema TSchema

Remarks

IFluidHandles--which have circular property references--are used in various places in SharedTree's persisted format. Handles should only be contained in sections of data which are validated against the empty schema {} (see https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01\#section-4.4).

Implementations of JsonValidator must therefore tolerate these values, despite the input not being valid JSON.

Parameters

Parameter Type Description
schema Schema A valid draft 6 JSON schema

Returns

Return type: SchemaValidationFunction<Schema>