json_schema library

JSON Schema generation based on Schemake schemas.

The generateJsonSchema function can be used to generate a JSON Schema for one or more Schemake types.

Classes

JsonSchemaOptions
Options for generating JSON Schemas.

Properties

jsonSchemaValidatorGenerators Map<Type, JsonSchemaWriterFunction>
Registry for functions that can generate JSON Schema declarations.
final

Functions

generateJsonSchema(SchemaType<Object?> schemaType, {String? schemaUri = jsonSchema_2020_12, String? schemaId, JsonSchemaOptions options = const JsonSchemaOptions()}) StringBuffer
Generate a JSON Schema where the given schemaType is the root type.
generateTypeJsonSchema(SchemaType<Object?> schemaType) StringBuffer
Simplified version of generateJsonSchema that only generates the type definition.

Typedefs

JsonSchemaWriterFunction = void Function(Object validator, SchemaType<Object?> type, StringBuffer buffer, JsonSchemaOptions options)
Signature of JSON Schema writer functions.