Class SchemaGeneratorConfigBuilder


  • public class SchemaGeneratorConfigBuilder
    extends Object
    Builder class for creating a configuration object to be passed into the SchemaGenerator's constructor.
    • Constructor Detail

      • SchemaGeneratorConfigBuilder

        public SchemaGeneratorConfigBuilder​(com.fasterxml.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 generated
        schemaVersion - designated JSON Schema version
        See Also:
        SchemaGeneratorConfigBuilder(ObjectMapper, SchemaVersion, OptionPreset)
      • SchemaGeneratorConfigBuilder

        public SchemaGeneratorConfigBuilder​(SchemaVersion schemaVersion)
        Constructor of an empty configuration builder with a default ObjectMapper instance. This is equivalent to calling:
        new SchemaGeneratorConfigBuilder(schemaVersion, OptionPreset.FULL_DOCUMENTATION)
        Parameters:
        schemaVersion - designated JSON Schema version
        See Also:
        SchemaGeneratorConfigBuilder(ObjectMapper, SchemaVersion, OptionPreset)
      • SchemaGeneratorConfigBuilder

        @Deprecated
        public SchemaGeneratorConfigBuilder​(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
                                            OptionPreset preset)
        Constructor of an empty configuration builder for a Draft 7 schema. 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 generated
        preset - default settings for standard Option values
      • SchemaGeneratorConfigBuilder

        public SchemaGeneratorConfigBuilder​(SchemaVersion schemaVersion,
                                            OptionPreset preset)
        Constructor of an empty configuration builder with a default ObjectMapper instance.
        Parameters:
        schemaVersion - designated JSON Schema version
        preset - default settings for standard Option values
      • SchemaGeneratorConfigBuilder

        public SchemaGeneratorConfigBuilder​(com.fasterxml.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 generated
        schemaVersion - designated JSON Schema version
        preset - default settings for standard Option values
    • Method Detail

      • build

        public SchemaGeneratorConfig build()
        Create a schema generator instance from the builder.
        Returns:
        successfully created/initialised generator instance
      • forTypesInGeneral

        public SchemaGeneratorGeneralConfigPart 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
      • getObjectMapper

        public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
        Retrieve the associated object mapper instance.
        Returns:
        supplier for object and array nodes for the JSON structure being generated
      • getSetting

        public Boolean getSetting​(Option setting)
        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

        public SchemaGeneratorConfigBuilder with​(Module module)
        Applying a module to this configuration builder instance.
        Parameters:
        module - configuration module to add/apply
        Returns:
        this builder instance (for chaining)
      • with

        public SchemaGeneratorConfigBuilder with​(Option setting,
                                                 Option... moreSettings)
        Enable an option for the schema generation.
        Parameters:
        setting - generator option to enable
        moreSettings - additional generator options to enable
        Returns:
        this builder instance (for chaining)
      • without

        public SchemaGeneratorConfigBuilder without​(Option setting,
                                                    Option... moreSettings)
        Disable an option for the schema generation.
        Parameters:
        setting - generator option to disable
        moreSettings - 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 overridden
        override - inclusion behaviour to apply for the given annotation type
        Returns:
        this builder instance (for chaining)
        Since:
        4.31.0
      • withObjectMapper

        public SchemaGeneratorConfigBuilder withObjectMapper​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
        Register a custom ObjectMapper to 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