Skip to content

Commit

Permalink
Add new OptBoolean valued property in @JsonTypeInfo to allow per-…
Browse files Browse the repository at this point in the history
…type configuration of strict type id handling (#223)
  • Loading branch information
JooHyukKim committed May 16, 2023
1 parent a693317 commit 624bbef
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/main/java/com/fasterxml/jackson/annotation/JsonTypeInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public enum As {
*
* @since 2.5
public boolean skipWritingDefault() default false;
/*
*/

/*
/**********************************************************
Expand All @@ -332,5 +332,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.
* <p>
* 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.
* <p>
* NOTE: This setting is specific to this type and will <strong>always override</strong> the global
* configuration of {@code MapperFeature#REQUIRE_TYPE_ID_FOR_SUBTYPES}.
*
* @since 2.16
*/
public OptBoolean requireTypeIdForSubtypes() default OptBoolean.DEFAULT;
}

0 comments on commit 624bbef

Please sign in to comment.