isSerializableSchema<
Input = unknown,
Output = Input
>(schema: SerializableSchema<Input, Output>): schema| Name | Type | Description |
|---|---|---|
schema* | SerializableSchema<Input, Output> |
Type guard to check if a given value is a SerializableSchema, i.e.
both a Standard Schema and a Standard JSON Schema object.
This checks for both the presence of a Standard Schema V1 interface and the ability to generate a JSON schema.
The value to test.
if (isSerializableSchema(schema)) {
schema["~standard"].validate(data);
const json = schema["~standard"].jsonSchema();
}