Enum JacksonOption
- java.lang.Object
-
- java.lang.Enum<JacksonOption>
-
- com.github.victools.jsonschema.module.jackson.JacksonOption
-
- All Implemented Interfaces:
Serializable
,Comparable<JacksonOption>
public enum JacksonOption extends Enum<JacksonOption>
Flags to enable/disable certain aspects of theJacksonModule
's processing.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ALWAYS_REF_SUBTYPES
Use this option to ensure all looked-up subtypes according to@JsonSubTypes
annotations are referenced via the central "$defs".FLATTENED_ENUMS_FROM_JSONPROPERTY
Use this option to treat enum types with aJsonProperty
annotation on each of its constants as plain strings in the generated schema.FLATTENED_ENUMS_FROM_JSONVALUE
Use this option to treat enum types with aJsonValue
annotation on one of its methods as plain strings in the generated schema.IGNORE_PROPERTY_NAMING_STRATEGY
Use this option to skip property name changes according toJsonNaming
annotations.IGNORE_TYPE_INFO_TRANSFORM
Use this option to skip the transformation according to@JsonTypeInfo
annotations (typically used to identify specific subtypes).INCLUDE_ONLY_JSONPROPERTY_ANNOTATED_METHODS
Use this option to ignore all methods that don't have aJsonProperty
annotation themselves or in case of getter methods on their associated field.INLINE_TRANSFORMED_SUBTYPES
Use this option to ensure all looked-up subtypes according to@JsonSubTypes
annotations are referenced via the central "$defs".JSONIDENTITY_REFERENCE_ALWAYS_AS_ID
Use this option to consider@JsonIdentityReference(alwaysAsId = true)
annotations on fields/methods or the type itself.RESPECT_JSONPROPERTY_ORDER
Use this option to sort an object's properties according to associatedJsonPropertyOrder
annotations.RESPECT_JSONPROPERTY_REQUIRED
Use this option to include fields annotated with@JsonProperty(required = true)
in the containing type's list of "required" properties.SKIP_SUBTYPE_LOOKUP
Use this option to skip the automatic look-up of subtypes according to@JsonSubTypes
annotations.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JacksonOption
valueOf(String name)
Returns the enum constant of this type with the specified name.static JacksonOption[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
FLATTENED_ENUMS_FROM_JSONVALUE
public static final JacksonOption FLATTENED_ENUMS_FROM_JSONVALUE
Use this option to treat enum types with aJsonValue
annotation on one of its methods as plain strings in the generated schema. If no such annotation withvalue = true
is present on exactly one argument-free method, it will fall-back on following custom definitions (e.g. from one of the standard generatorOption
s).
This can be enabled at the same time as theFLATTENED_ENUMS_FROM_JSONPROPERTY
option, with theJsonValue
annotation taking precedence.
-
FLATTENED_ENUMS_FROM_JSONPROPERTY
public static final JacksonOption FLATTENED_ENUMS_FROM_JSONPROPERTY
Use this option to treat enum types with aJsonProperty
annotation on each of its constants as plain strings in the generated schema. If no such annotation is present on each enum constants, it will fall-back on following custom definitions (e.g. from one of the standard generatorOption
s).
This can be enabled at the same time as theFLATTENED_ENUMS_FROM_JSONVALUE
option, with theJsonValue
annotation taking precedence.
-
RESPECT_JSONPROPERTY_ORDER
public static final JacksonOption RESPECT_JSONPROPERTY_ORDER
Use this option to sort an object's properties according to associatedJsonPropertyOrder
annotations. Fields and methods without such an annotation are listed after annotated properties.
-
INCLUDE_ONLY_JSONPROPERTY_ANNOTATED_METHODS
public static final JacksonOption INCLUDE_ONLY_JSONPROPERTY_ANNOTATED_METHODS
Use this option to ignore all methods that don't have aJsonProperty
annotation themselves or in case of getter methods on their associated field. When including non-getter methods with annotated property names, you'll probably want to enable the generalOption.FIELDS_DERIVED_FROM_ARGUMENTFREE_METHODS
as well, in order to avoid parentheses at the end.- Since:
- 4.21.0
- See Also:
Option.FIELDS_DERIVED_FROM_ARGUMENTFREE_METHODS
-
IGNORE_PROPERTY_NAMING_STRATEGY
public static final JacksonOption IGNORE_PROPERTY_NAMING_STRATEGY
Use this option to skip property name changes according toJsonNaming
annotations.
-
ALWAYS_REF_SUBTYPES
public static final JacksonOption ALWAYS_REF_SUBTYPES
Use this option to ensure all looked-up subtypes according to@JsonSubTypes
annotations are referenced via the central "$defs". This applies to the wrapping schema produced based on@JsonTypeInfo
annotations, e.g., with wrapping object/array or additional property.- Since:
- 4.27.0
-
INLINE_TRANSFORMED_SUBTYPES
public static final JacksonOption INLINE_TRANSFORMED_SUBTYPES
Use this option to ensure all looked-up subtypes according to@JsonSubTypes
annotations are referenced via the central "$defs". This applies to the nested schema inside the wrapping object/array or "allOf" based on@JsonTypeInfo
annotations. This can be used to counter-act theOption.DEFINITIONS_FOR_ALL_OBJECTS
. Beware: as with every explicit inlining, recursive non-transformed references can result in a stack overflow during schema generation when this option is enabled (similar toOption.INLINE_ALL_SCHEMAS
)!- Since:
- 4.30.0
-
SKIP_SUBTYPE_LOOKUP
public static final JacksonOption SKIP_SUBTYPE_LOOKUP
Use this option to skip the automatic look-up of subtypes according to@JsonSubTypes
annotations.
-
IGNORE_TYPE_INFO_TRANSFORM
public static final JacksonOption IGNORE_TYPE_INFO_TRANSFORM
Use this option to skip the transformation according to@JsonTypeInfo
annotations (typically used to identify specific subtypes).
-
RESPECT_JSONPROPERTY_REQUIRED
public static final JacksonOption RESPECT_JSONPROPERTY_REQUIRED
Use this option to include fields annotated with@JsonProperty(required = true)
in the containing type's list of "required" properties.- Since:
- 4.18.0
-
JSONIDENTITY_REFERENCE_ALWAYS_AS_ID
public static final JacksonOption JSONIDENTITY_REFERENCE_ALWAYS_AS_ID
Use this option to consider@JsonIdentityReference(alwaysAsId = true)
annotations on fields/methods or the type itself.- Since:
- 4.28.0
-
-
Method Detail
-
values
public static JacksonOption[] 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 (JacksonOption c : JacksonOption.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static JacksonOption 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 nameNullPointerException
- if the argument is null
-
-