Skip to main content

Module json_schema

Module json_schema 

Source
Expand description

Utility for generating standalone JSON Schema documents from schemars::JsonSchema types.

This module provides functionality to generate standalone JSON Schema draft 2020-12 documents suitable for code generation tools like datamodel-code-generator.

Enums§

Refs
Controls how external type references are handled in the generated schema.

Functions§

finalize_discriminators
Post-process a generated schema to make discriminated unions work correctly with code generators like datamodel-code-generator.
finalize_discriminators_with_prefix
Like finalize_discriminators, but with a configurable $ref prefix.
generate_json_schema
Generate a standalone JSON Schema document from a type implementing JsonSchema.
generate_json_schema_custom
Generate a JSON Schema document with configurable reference handling and additional types seeded into $defs.
generate_json_schema_with_defs
Generate a standalone JSON Schema document with all $defs included.
generate_json_schema_with_refs
Generate a JSON Schema document with configurable reference handling.