Class SchemaBuilder
java.lang.Object
com.github.victools.jsonschema.generator.SchemaBuilder
Builder for a single schema being generated.
-
Method Summary
Modifier and TypeMethodDescriptiontools.jackson.databind.node.ObjectNodecollectDefinitions(String designatedDefinitionPath) Completing the schema generation (aftercreateSchemaReference(Type, Type...)was invoked for all relevant types) by creating anObjectNodecontaining common schema definitions.tools.jackson.databind.node.ObjectNodecreateSchemaReference(Type targetType, Type... typeParameters) Generate anObjectNodeplaceholder for the given type and add all referenced/encountered types to this builder instance.
-
Method Details
-
createSchemaReference
public tools.jackson.databind.node.ObjectNode createSchemaReference(Type targetType, Type... typeParameters) Generate anObjectNodeplaceholder for the given type and add all referenced/encountered types to this builder instance.
This may be invoked multiple times (even for the same type) until the schema generation is being completed viacollectDefinitions(String).- Parameters:
targetType- type for which to generate the JSON Schema placeholdertypeParameters- optional type parameters (in case of themainTargetTypebeing a parameterised type)- Returns:
- JSON Schema placeholder (maybe be empty until
collectDefinitions(String)is being invoked) - See Also:
-
collectDefinitions
Completing the schema generation (aftercreateSchemaReference(Type, Type...)was invoked for all relevant types) by creating anObjectNodecontaining common schema definitions.The given definition path (e.g.
This should only be invoked once at the very end of the schema generation process."definitions","$defs","components/schemas") will be used in generated"$ref"values (e.g."#/definitions/YourType","#/$defs/YourType","#/components/schemas/YourType").- Parameters:
designatedDefinitionPath- the designated path to the returned definitions node, to be used in generated references- Returns:
- object node containing common schema definitions
- See Also:
-