diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonTypeInfo.java b/src/main/java/com/fasterxml/jackson/annotation/JsonTypeInfo.java index ea104c75..e4016a5f 100644 --- a/src/main/java/com/fasterxml/jackson/annotation/JsonTypeInfo.java +++ b/src/main/java/com/fasterxml/jackson/annotation/JsonTypeInfo.java @@ -313,7 +313,7 @@ public enum As { * * @since 2.5 public boolean skipWritingDefault() default false; - /* + */ /* /********************************************************** @@ -330,5 +330,22 @@ public enum As { * if such behavior is needed; this is rarely necessary. */ @Deprecated - public abstract static class None { } + public abstract static class None {} + + /** + * Specifies whether the type ID should be strictly required during polymorphic deserialization of its subtypes. + *

+ * If set to {@link OptBoolean#TRUE}, an {@code InvalidTypeIdException} will be thrown if no type + * information is provided. + * If set to {@link OptBoolean#FALSE}, deserialization may proceed without type information if the + * subtype is a legitimate target (non-abstract). + * If set to {@link OptBoolean#DEFAULT}, the global configuration of + * {@code MapperFeature#REQUIRE_TYPE_ID_FOR_SUBTYPES} is used for type ID handling. + *

+ * NOTE: This setting is specific to this type and will always override the global + * configuration of {@code MapperFeature#REQUIRE_TYPE_ID_FOR_SUBTYPES}. + * + * @since 2.16 + */ + public OptBoolean requireTypeIdForSubtypes() default OptBoolean.DEFAULT; }