Enum Class Option
- All Implemented Interfaces:
Serializable,Comparable<Option>,Constable
Configuration options to be set on a
SchemaGeneratorConfigBuilder instance.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionWhether each property with a container/Collectiontype should also allow for a single collection item to be provided instead of an array.Whether additional types (and not just primitives and their associated classes should be included as fixed schema with aSchemaKeyword.TAG_TYPEattribute of "string"/"boolean"/"integer"/"number".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.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.Whether all referenced objects should be listed in the schema's "definitions"/"$defs".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.Whether at the end of the schema generation, all member sub-schemas referencing a common definition should be checked for any duplicated attributes, which should be removed from the inline member sub-schemas in favor of the equivalent in the single common definition.Whether allowed values should always be included in an"enum"keyword.For the "format" attribute, JSON Schema defines various supported values.Whether methods that do not expect any arguments, should be treated as fields: i.e. renaming the property.Whether enums should be treated as plainSchemaKeyword.TAG_TYPE_STRINGvalues - derived from their respective constant name.Whether enums should be treated as plainSchemaKeyword.TAG_TYPE_STRINGvalues - derived from their respectivetoString().Whether anyOptionalinstance should be treated as nullable value of the wrapped type.Whether aSupplier<T>instance should be treated as the wrapped typeT.Whether a schema's "additionalProperties" should be set to "false" if no specific configuration says otherwise.Whether getter methods should be included (assuming their fields are not included).Whether all sub-schemas should be defined in-line, i.e. including no "definitions"/"$defs".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".Whether aMap<K, V>schema's "additionalProperties" should be set to its declared value typeV.Whether fields with private/package/protected visibility, for which a respective getter method can be found, should be included.Whether fields with private/package/protected visibility and no accompanying getter method should be included.Whetherstaticfields with private/package/protected visibility should be included.Whether methods that are (1) notstatic, (2) have a specific return value and (3) are not getters, should be included.Whether a{"type":"null"}schema should always be grouped as"anyOf"with the not-null schema.Whether a container/collection/array item should be subject to the standard nullable checks.Whether an object's field/property should be deemed to be nullable if no specific check says otherwise.Whether a method's return value should be deemed to be nullable if no specific check says otherwise.Generally, keys in the collected "definitions"/"$defs" are ensured to be URI compatible but may include parentheses and commas for listing type parameters.Whetherstaticfields with public visibility should be included.Whetherstaticfields with public visibility should be included.Whether theSchemaKeyword.TAG_SCHEMAattribute withSchemaKeyword.TAG_SCHEMA_VALUEshould be included.Whether enums should be treated asSchemaKeyword.TAG_TYPE_OBJECT, with all methods butname()being excluded.Whether anyOptionalinstance should be reduced to an object with only three methods.For the "format" attribute, JSON Schema defines various supported values.Whether methods that arestaticshould be included.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.Whethertransientfields should be included.Whether the constant values of static final fields should be included.Whether methods without return value (e.g. setters) should be included. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisOverriding(Option otherOption) Check whether the given option is being ignored if this one enabled.static OptionReturns the enum constant of this class with the specified name.static Option[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SCHEMA_VERSION_INDICATOR
Whether theSchemaKeyword.TAG_SCHEMAattribute withSchemaKeyword.TAG_SCHEMA_VALUEshould be included. -
ADDITIONAL_FIXED_TYPES
Whether additional types (and not just primitives and their associated classes should be included as fixed schema with aSchemaKeyword.TAG_TYPEattribute of "string"/"boolean"/"integer"/"number". -
SIMPLIFIED_ENUMS
Whether enums should be treated asSchemaKeyword.TAG_TYPE_OBJECT, with all methods butname()being excluded.
This only takes effect ifFLATTENED_ENUMSandFLATTENED_ENUMS_FROM_TOSTRINGare disabled.- See Also:
-
FLATTENED_ENUMS
Whether enums should be treated as plainSchemaKeyword.TAG_TYPE_STRINGvalues - derived from their respective constant name.
This only takes effect ifFLATTENED_ENUMS_FROM_TOSTRINGis disabled but takes priority overSIMPLIFIED_ENUMS. -
FLATTENED_ENUMS_FROM_TOSTRING
Whether enums should be treated as plainSchemaKeyword.TAG_TYPE_STRINGvalues - derived from their respectivetoString().
This takes priority over bothFLATTENED_ENUMSandSIMPLIFIED_ENUMS.- See Also:
-
SIMPLIFIED_OPTIONALS
Whether anyOptionalinstance should be reduced to an object with only three methods.
This only takes effect ifFLATTENED_OPTIONALSis disabled. -
FLATTENED_OPTIONALS
Whether anyOptionalinstance should be treated as nullable value of the wrapped type.
This takes priority overSIMPLIFIED_OPTIONALS.- See Also:
-
FLATTENED_SUPPLIERS
Whether aSupplier<T>instance should be treated as the wrapped typeT.- Since:
- 4.25.0
-
VALUES_FROM_CONSTANT_FIELDS
Whether the constant values of static final fields should be included. -
PUBLIC_STATIC_FIELDS
Whetherstaticfields with public visibility should be included. -
PUBLIC_NONSTATIC_FIELDS
Whetherstaticfields with public visibility should be included. -
NONPUBLIC_STATIC_FIELDS
Whetherstaticfields with private/package/protected visibility should be included. -
NONPUBLIC_NONSTATIC_FIELDS_WITH_GETTERS
Whether fields with private/package/protected visibility, for which a respective getter method can be found, should be included. -
NONPUBLIC_NONSTATIC_FIELDS_WITHOUT_GETTERS
Whether fields with private/package/protected visibility and no accompanying getter method should be included. -
TRANSIENT_FIELDS
Whethertransientfields should be included. -
STATIC_METHODS
Whether methods that arestaticshould be included. -
VOID_METHODS
Whether methods without return value (e.g. setters) should be included. -
GETTER_METHODS
Whether getter methods should be included (assuming their fields are not included). -
NONSTATIC_NONVOID_NONGETTER_METHODS
Whether methods that are (1) notstatic, (2) have a specific return value and (3) are not getters, should be included.- See Also:
-
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
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
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'sisFakeContainerItemScope()indication.- Since:
- 4.20.0
-
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
Whether aMap<K, V>schema's "additionalProperties" should be set to its declared value typeV.- Since:
- 4.11.0
-
ACCEPT_SINGLE_VALUE_AS_ARRAY
Whether each property with a container/Collectiontype should also allow for a single collection item to be provided instead of an array. This corresponds to the JacksonACCEPT_SINGLE_VALUE_AS_ARRAYfeature.- Since:
- 4.36.0
-
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
-
NULLABLE_ALWAYS_AS_ANYOF
Whether a{"type":"null"}schema should always be grouped as"anyOf"with the not-null schema. Otherwise, it is deemed acceptable to include the"null"option in the main schema's"type"value, e.g. as{"type":["null","string]}resulting in a simpler/smaller schema overall.- Since:
- 4.37.0
-
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
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
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_09onward. Before that, everything besides "$ref" would be ignored.- Since:
- 4.11.0
-
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
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 overDEFINITIONS_FOR_ALL_OBJECTSin this specific case. The non-nullable sub-schema is unaffected by this setting.- Since:
- 4.33.0
-
INLINE_ALL_SCHEMAS
Whether all sub-schemas should be defined in-line, i.e. including no "definitions"/"$defs". This takes precedence overDEFINITIONS_FOR_ALL_OBJECTSandDEFINITION_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
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
For the "format" attribute, JSON Schema defines various supported values.
Some of those data-types would be included if eitherADDITIONAL_FIXED_TYPESis enabled or a customSimpleTypeModuleare added. By enabling this option, only the standard built-in "format" values would be added, which is a subset of the values considered with theEXTRA_OPEN_API_FORMAT_VALUESbeing enabled.- Since:
- 4.33.0
-
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) ifADDITIONAL_FIXED_TYPESis 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
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
-
DUPLICATE_MEMBER_ATTRIBUTE_CLEANUP_AT_THE_END
Whether at the end of the schema generation, all member sub-schemas referencing a common definition should be checked for any duplicated attributes, which should be removed from the inline member sub-schemas in favor of the equivalent in the single common definition.- Since:
- 4.34.0
-
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 Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
isOverriding
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
-