Enum Option

    • Enum Constant Detail

      • ADDITIONAL_FIXED_TYPES

        public static final Option ADDITIONAL_FIXED_TYPES
        Whether additional types (and not just primitives and their associated classes should be included as fixed schema with a SchemaKeyword.TAG_TYPE attribute of "string"/"boolean"/"integer"/"number".
      • FLATTENED_SUPPLIERS

        public static final Option FLATTENED_SUPPLIERS
        Whether a Supplier<T> instance should be treated as the wrapped type T.
        Since:
        4.25.0
      • VALUES_FROM_CONSTANT_FIELDS

        public static final Option VALUES_FROM_CONSTANT_FIELDS
        Whether the constant values of static final fields should be included.
      • NONSTATIC_NONVOID_NONGETTER_METHODS

        public static final Option NONSTATIC_NONVOID_NONGETTER_METHODS
        Whether methods that are (1) not static, (2) have a specific return value and (3) are not getters, should be included.
        See Also:
        STATIC_METHODS, VOID_METHODS, GETTER_METHODS
      • NULLABLE_FIELDS_BY_DEFAULT

        public static final Option NULLABLE_FIELDS_BY_DEFAULT
        Whether an object's field/property should be deemed to be nullable if no specific check says otherwise.
        Without this option, all fields are deemed not-nullable unless a specific check says otherwise.
      • NULLABLE_METHOD_RETURN_VALUES_BY_DEFAULT

        public static final Option NULLABLE_METHOD_RETURN_VALUES_BY_DEFAULT
        Whether a method's return value should be deemed to be nullable if no specific check says otherwise.
        Without this option, all methods' return values are deemed not-nullable unless a specific check says otherwise.
      • NULLABLE_ARRAY_ITEMS_ALLOWED

        public static final Option NULLABLE_ARRAY_ITEMS_ALLOWED
        Whether a container/collection/array item should be subject to the standard nullable checks.
        Without this option, no null values are allowed in any array.
        Beware: with this option enabled, all nullable checks may need to consider the field/method's isFakeContainerItemScope() indication.
        Since:
        4.20.0
      • FIELDS_DERIVED_FROM_ARGUMENTFREE_METHODS

        public static final Option FIELDS_DERIVED_FROM_ARGUMENTFREE_METHODS
        Whether methods that do not expect any arguments, should be treated as fields: i.e. renaming the property.
      • MAP_VALUES_AS_ADDITIONAL_PROPERTIES

        public static final Option MAP_VALUES_AS_ADDITIONAL_PROPERTIES
        Whether a Map<K, V> schema's "additionalProperties" should be set to its declared value type V.
        Since:
        4.11.0
      • ENUM_KEYWORD_FOR_SINGLE_VALUES

        public static final Option ENUM_KEYWORD_FOR_SINGLE_VALUES
        Whether allowed values should always be included in an "enum" keyword. If there is exactly one allowed value, it will otherwise be represented by a "const" keyword instead.
        Since:
        4.16.0
      • FORBIDDEN_ADDITIONAL_PROPERTIES_BY_DEFAULT

        public static final Option FORBIDDEN_ADDITIONAL_PROPERTIES_BY_DEFAULT
        Whether a schema's "additionalProperties" should be set to "false" if no specific configuration says otherwise.
        Without this option, i.e. by default, the "additionalProperties" keyword will be omitted and thereby allowing any additional properties in an object schema.
        Since:
        4.2.0
      • DEFINITIONS_FOR_ALL_OBJECTS

        public static final Option DEFINITIONS_FOR_ALL_OBJECTS
        Whether all referenced objects should be listed in the schema's "definitions"/"$defs".
        Without this option, only those subschemas will be "$ref"-erenced if they occur more than once – in-lining everything else.
      • DEFINITION_FOR_MAIN_SCHEMA

        public static final Option DEFINITION_FOR_MAIN_SCHEMA
        Whether the schema for the target/main type should be included in the "definitions"/"$defs" – thereby avoiding an potential "$ref": "#" and assigning a name to it like for all other defined subschemas.
        Otherwise, "$ref"-erences to the main/target schema will use the empty fragment ("#") and it will not be listed in the "definitions"/"$defs".

        Beware: this only results in a valid schema from SchemaVersion.DRAFT_2019_09 onward. Before that, everything besides "$ref" would be ignored.

        Since:
        4.11.0
      • DEFINITIONS_FOR_MEMBER_SUPERTYPES

        public static final Option DEFINITIONS_FOR_MEMBER_SUPERTYPES
        Whether a member (field/method), having a declared type for which subtypes are being detected, should be included as standalone definition with any collected member attributes assigned directly – and the subtypes only being handled as generic types – or each of its subtypes should be treated as alternative sub-schema for this member (field/method) including any attributes derived from that member.
        Warning: this should only be enabled if there are no relevant annotations (e.g. like jackson @JsonTypeInfo) on individual properties, that override the general behavior exclusively for single subtypes.
        Since:
        4.27.0
      • INLINE_NULLABLE_SCHEMAS

        public static final Option INLINE_NULLABLE_SCHEMAS
        Whether the "nullable" variants of a sub-schema should be defined in-line, i.e., avoiding a second "MyType-nullable" entry in the "definitions"/"$defs". This takes precedence over DEFINITIONS_FOR_ALL_OBJECTS in this specific case. The non-nullable sub-schema is unaffected by this setting.
        Since:
        4.33.0
      • INLINE_ALL_SCHEMAS

        public static final Option INLINE_ALL_SCHEMAS
        Whether all sub-schemas should be defined in-line, i.e. including no "definitions"/"$defs". This takes precedence over DEFINITIONS_FOR_ALL_OBJECTS and DEFINITION_FOR_MAIN_SCHEMA.

        Beware: This will result in an exception being thrown if a single circular reference is being encountered!

        Since:
        4.10.0
      • PLAIN_DEFINITION_KEYS

        public static final Option PLAIN_DEFINITION_KEYS
        Generally, keys in the collected "definitions"/"$defs" are ensured to be URI compatible but may include parentheses and commas for listing type parameters. By enabling this option, these parentheses and commas will be removed to conform with a reduced set of characters, e.g. as expected by OpenAPI: following the regular expression ^[a-zA-Z0-9\.\-_]+$.
        Since:
        4.11.0
      • STANDARD_FORMATS

        public static final Option STANDARD_FORMATS
        For the "format" attribute, JSON Schema defines various supported values.
        Some of those data-types would be included if either ADDITIONAL_FIXED_TYPES is enabled or a custom SimpleTypeModule are added. By enabling this option, only the standard built-in "format" values would be added, which is a subset of the values considered with the EXTRA_OPEN_API_FORMAT_VALUES being enabled.
        Since:
        4.33.0
      • EXTRA_OPEN_API_FORMAT_VALUES

        public static final Option EXTRA_OPEN_API_FORMAT_VALUES
        For the "format" attribute, JSON Schema defines various supported values. The OpenAPI specification assigns a few more of those in order to differentiate between standard data types (e.g. float vs. double) and even some more fixed data types (e.g. LocalDate, LocalDateTime) if ADDITIONAL_FIXED_TYPES is enabled. By enabling this option, these extra "format" values will be set for the respective primitive/standard data types automatically.
        Since:
        4.15.0
      • ALLOF_CLEANUP_AT_THE_END

        public static final Option ALLOF_CLEANUP_AT_THE_END
        Whether as the last step of the schema generation, unnecessary "allOf" elements (i.e. where there are no conflicts/overlaps between the contained sub-schemas) should be merged into one, in order to make the generated schema more readable. This also applies to manually added "allOf" elements, e.g. through custom definitions or attribute overrides.
        Since:
        4.6.0
      • STRICT_TYPE_INFO

        public static final Option STRICT_TYPE_INFO
        Whether at the end of the schema generation, all sub-schemas without an explicit "type" indication should be augmented by the implied "type" based on the other tags in the respective schema.
        Since:
        4.30.0
    • Method Detail

      • values

        public static Option[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Option c : Option.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Option valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • isOverriding

        public boolean isOverriding​(Option otherOption)
        Check whether the given option is being ignored if this one enabled.
        Parameters:
        otherOption - option that may be ignored
        Returns:
        whether the given option is being ignored in case of this one being enabled