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_SUBTYPESUse this option to ensure all looked-up subtypes according to@JsonSubTypesannotations are referenced via the central "$defs".FLATTENED_ENUMS_FROM_JSONPROPERTYUse this option to treat enum types with aJsonPropertyannotation on each of its constants as plain strings in the generated schema.FLATTENED_ENUMS_FROM_JSONVALUEUse this option to treat enum types with aJsonValueannotation on one of its methods as plain strings in the generated schema.IGNORE_PROPERTY_NAMING_STRATEGYUse this option to skip property name changes according toJsonNamingannotations.IGNORE_TYPE_INFO_TRANSFORMUse this option to skip the transformation according to@JsonTypeInfoannotations (typically used to identify specific subtypes).INCLUDE_ONLY_JSONPROPERTY_ANNOTATED_METHODSUse this option to ignore all methods that don't have aJsonPropertyannotation themselves or in case of getter methods on their associated field.INLINE_TRANSFORMED_SUBTYPESUse this option to ensure all looked-up subtypes according to@JsonSubTypesannotations are referenced via the central "$defs".JSONIDENTITY_REFERENCE_ALWAYS_AS_IDUse this option to consider@JsonIdentityReference(alwaysAsId = true)annotations on fields/methods or the type itself.RESPECT_JSONPROPERTY_ORDERUse this option to sort an object's properties according to associatedJsonPropertyOrderannotations.RESPECT_JSONPROPERTY_REQUIREDUse this option to include fields annotated with@JsonProperty(required = true)in the containing type's list of "required" properties.SKIP_SUBTYPE_LOOKUPUse this option to skip the automatic look-up of subtypes according to@JsonSubTypesannotations.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JacksonOptionvalueOf(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 aJsonValueannotation on one of its methods as plain strings in the generated schema. If no such annotation withvalue = trueis present on exactly one argument-free method, it will fall-back on following custom definitions (e.g. from one of the standard generatorOptions).
This can be enabled at the same time as theFLATTENED_ENUMS_FROM_JSONPROPERTYoption, with theJsonValueannotation taking precedence.
-
FLATTENED_ENUMS_FROM_JSONPROPERTY
public static final JacksonOption FLATTENED_ENUMS_FROM_JSONPROPERTY
Use this option to treat enum types with aJsonPropertyannotation 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 generatorOptions).
This can be enabled at the same time as theFLATTENED_ENUMS_FROM_JSONVALUEoption, with theJsonValueannotation taking precedence.
-
RESPECT_JSONPROPERTY_ORDER
public static final JacksonOption RESPECT_JSONPROPERTY_ORDER
Use this option to sort an object's properties according to associatedJsonPropertyOrderannotations. 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 aJsonPropertyannotation 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_METHODSas 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 toJsonNamingannotations.
-
ALWAYS_REF_SUBTYPES
public static final JacksonOption ALWAYS_REF_SUBTYPES
Use this option to ensure all looked-up subtypes according to@JsonSubTypesannotations are referenced via the central "$defs". This applies to the wrapping schema produced based on@JsonTypeInfoannotations, 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@JsonSubTypesannotations are referenced via the central "$defs". This applies to the nested schema inside the wrapping object/array or "allOf" based on@JsonTypeInfoannotations. 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@JsonSubTypesannotations.
-
IGNORE_TYPE_INFO_TRANSFORM
public static final JacksonOption IGNORE_TYPE_INFO_TRANSFORM
Use this option to skip the transformation according to@JsonTypeInfoannotations (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
-
-