Skip to main content

generate_json_schema_custom

Function generate_json_schema_custom 

Source
pub fn generate_json_schema_custom<T: JsonSchema>(
    refs: Refs,
    seed: impl FnOnce(&mut SchemaGenerator),
) -> Value
Expand description

Generate a JSON Schema document with configurable reference handling and additional types seeded into $defs.

The seed callback receives a &mut SchemaGenerator before the root schema is finalised. Calling generator.subschema_for::<ExtraType>() inside the callback ensures the type (and all its transitive deps) appear in $defs even when they are not reachable from the root type T.