Class SchemaGeneratorConfigBuilder
java.lang.Object
com.github.victools.jsonschema.generator.SchemaGeneratorConfigBuilder
Builder class for creating a configuration object to be passed into the SchemaGenerator's constructor.
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaGeneratorConfigBuilder(SchemaVersion schemaVersion) Constructor of an empty configuration builder with a defaultObjectMapperinstance.SchemaGeneratorConfigBuilder(SchemaVersion schemaVersion, OptionPreset preset) Constructor of an empty configuration builder with a defaultObjectMapperinstance.SchemaGeneratorConfigBuilder(tools.jackson.databind.ObjectMapper objectMapper) Deprecated.SchemaGeneratorConfigBuilder(tools.jackson.databind.ObjectMapper objectMapper, OptionPreset preset) Deprecated.SchemaGeneratorConfigBuilder(tools.jackson.databind.ObjectMapper objectMapper, SchemaVersion schemaVersion) Constructor of an empty configuration builder.SchemaGeneratorConfigBuilder(tools.jackson.databind.ObjectMapper objectMapper, SchemaVersion schemaVersion, OptionPreset preset) Constructor of an empty configuration builder. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Create a schema generator instance from the builder.Get the part of this configuration builder dedicated to custom attribute look-ups for fields.Get the part of this configuration builder dedicated to custom attribute look-ups for methods.Get the part of this configuration builder dedicated to custom attribute look-ups for types in general, independent of the declaration context.tools.jackson.databind.ObjectMapperRetrieve the associated object mapper instance.getSetting(Option setting) Check whether the given setting/option has been set and if yes, whether it is enabled or disabled.with(CustomDefinitionProviderV2 definitionProvider) Deprecated.Applying a module to this configuration builder instance.Enable an option for the schema generation.with(TypeAttributeOverride override) Deprecated.withAnnotationInclusionOverride(Class<? extends Annotation> annotationType, com.fasterxml.classmate.AnnotationInclusion override) Register an explicit annotation inclusion rule for a given annotation type.withObjectMapper(tools.jackson.databind.ObjectMapper objectMapper) Register a customObjectMapperto create object and array nodes for the JSON structure being generated.Disable an option for the schema generation.
-
Constructor Details
-
SchemaGeneratorConfigBuilder
Deprecated.Constructor of an empty configuration builder for aDraft 7schema. This is equivalent to calling:
new SchemaGeneratorConfigBuilder(objectMapper, SchemaVersion.DRAFT_7, OptionPreset.FULL_DOCUMENTATION)- Parameters:
objectMapper- supplier for object and array nodes for the JSON structure being generated- See Also:
-
SchemaGeneratorConfigBuilder
public SchemaGeneratorConfigBuilder(tools.jackson.databind.ObjectMapper objectMapper, SchemaVersion schemaVersion) Constructor of an empty configuration builder. This is equivalent to calling:
new SchemaGeneratorConfigBuilder(objectMapper, schemaVersion, OptionPreset.FULL_DOCUMENTATION)- Parameters:
objectMapper- supplier for object and array nodes for the JSON structure being generatedschemaVersion- designated JSON Schema version- See Also:
-
SchemaGeneratorConfigBuilder
Constructor of an empty configuration builder with a defaultObjectMapperinstance. This is equivalent to calling:
new SchemaGeneratorConfigBuilder(schemaVersion, OptionPreset.FULL_DOCUMENTATION)- Parameters:
schemaVersion- designated JSON Schema version- See Also:
-
SchemaGeneratorConfigBuilder
@Deprecated public SchemaGeneratorConfigBuilder(tools.jackson.databind.ObjectMapper objectMapper, OptionPreset preset) Deprecated.Constructor of an empty configuration builder for aDraft 7schema. This is equivalent to calling:
new SchemaGeneratorConfigBuilder(objectMapper, SchemaVersion.DRAFT_7, preset)- Parameters:
objectMapper- supplier for object and array nodes for the JSON structure being generatedpreset- default settings for standardOptionvalues
-
SchemaGeneratorConfigBuilder
Constructor of an empty configuration builder with a defaultObjectMapperinstance.- Parameters:
schemaVersion- designated JSON Schema versionpreset- default settings for standardOptionvalues
-
SchemaGeneratorConfigBuilder
public SchemaGeneratorConfigBuilder(tools.jackson.databind.ObjectMapper objectMapper, SchemaVersion schemaVersion, OptionPreset preset) Constructor of an empty configuration builder.- Parameters:
objectMapper- supplier for object and array nodes for the JSON structure being generatedschemaVersion- designated JSON Schema versionpreset- default settings for standardOptionvalues
-
-
Method Details
-
build
Create a schema generator instance from the builder.- Returns:
- successfully created/initialised generator instance
-
forTypesInGeneral
Get the part of this configuration builder dedicated to custom attribute look-ups for types in general, independent of the declaration context.- Returns:
- configuration part responsible for handling types regardless of their declaration context
-
forFields
Get the part of this configuration builder dedicated to custom attribute look-ups for fields.- Returns:
- configuration part responsible for handling of fields
- See Also:
-
forMethods
Get the part of this configuration builder dedicated to custom attribute look-ups for methods.- Returns:
- configuration part responsible for handling of methods
- See Also:
-
getObjectMapper
public tools.jackson.databind.ObjectMapper getObjectMapper()Retrieve the associated object mapper instance.- Returns:
- supplier for object and array nodes for the JSON structure being generated
-
getSetting
Check whether the given setting/option has been set and if yes, whether it is enabled or disabled.- Parameters:
setting- generator option to check for- Returns:
- currently configured flag (i.e. true/false if already set), or null if not configured
-
with
Applying a module to this configuration builder instance.- Parameters:
module- configuration module to add/apply- Returns:
- this builder instance (for chaining)
-
with
Deprecated.Adding a custom schema provider - if it returns null for a given type, the next definition provider will be applied.
If all custom schema providers return null (or there is none), then the standard behaviour applies.- Parameters:
definitionProvider- provider of a custom definition to register, which may return null- Returns:
- this builder instance (for chaining)
-
with
Deprecated.Adding an override for type attributes - all the registered overrides will be applied in the order of having been added.- Parameters:
override- adding/removing attributes on a JSON Schema node - specifically intended for attributes relating to the type in general.- Returns:
- this builder instance (for chaining)
-
with
Enable an option for the schema generation.- Parameters:
setting- generator option to enablemoreSettings- additional generator options to enable- Returns:
- this builder instance (for chaining)
-
without
Disable an option for the schema generation.- Parameters:
setting- generator option to disablemoreSettings- additional generator options to disable- Returns:
- this builder instance (for chaining)
-
withAnnotationInclusionOverride
public SchemaGeneratorConfigBuilder withAnnotationInclusionOverride(Class<? extends Annotation> annotationType, com.fasterxml.classmate.AnnotationInclusion override) Register an explicit annotation inclusion rule for a given annotation type.- Parameters:
annotationType- type of annotation for which the inclusion behaviour should be overriddenoverride- inclusion behaviour to apply for the given annotation type- Returns:
- this builder instance (for chaining)
- Since:
- 4.31.0
-
withObjectMapper
public SchemaGeneratorConfigBuilder withObjectMapper(tools.jackson.databind.ObjectMapper objectMapper) Register a customObjectMapperto create object and array nodes for the JSON structure being generated. Additionally, it is used to serialize a given schema, e.g., within the standard Maven plugin as either YAML or JSON.- Parameters:
objectMapper- supplier for object and array nodes for the JSON structure being generated- Returns:
- this builder instance (for chaining)
- Since:
- 4.32.0
-
SchemaGeneratorConfigBuilder(ObjectMapper, SchemaVersion)instead