Skip to content

Commit e5d22e2

Browse files
alevskyicowtowncoder
authored andcommitted
Add check for ALLOW_CASE_INSENSITIVE_PROPERTIES feature #1983
1 parent 800eaf2 commit e5d22e2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/main/java/com/fasterxml/jackson/databind/jsontype/impl/AsPropertyTypeDeserializer.java

+4
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,12 @@ public Object deserializeTypedFromObject(JsonParser p, DeserializationContext ct
9090
// Ok, let's try to find the property. But first, need token buffer...
9191
TokenBuffer tb = null;
9292

93+
boolean ignoreCase = ctxt.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
9394
for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) {
9495
String name = p.getCurrentName();
96+
if (ignoreCase) {
97+
name = name.toLowerCase();
98+
}
9599
p.nextToken(); // to point to the value
96100
if (name.equals(_typePropertyName)) { // gotcha!
97101
return _deserializeTypedForId(p, ctxt, tb);

src/main/java/com/fasterxml/jackson/databind/jsontype/impl/TypeNameIdResolver.java

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fasterxml.jackson.databind.BeanDescription;
88
import com.fasterxml.jackson.databind.DatabindContext;
99
import com.fasterxml.jackson.databind.JavaType;
10+
import com.fasterxml.jackson.databind.MapperFeature;
1011
import com.fasterxml.jackson.databind.cfg.MapperConfig;
1112
import com.fasterxml.jackson.databind.jsontype.NamedType;
1213

@@ -138,6 +139,9 @@ public JavaType typeFromId(DatabindContext context, String id) {
138139
}
139140

140141
protected JavaType _typeFromId(String id) {
142+
if(_config.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)) {
143+
id = id.toLowerCase();
144+
}
141145
// Now: if no type is found, should we try to locate it by
142146
// some other means? (specifically, if in same package as base type,
143147
// could just try Class.forName)

0 commit comments

Comments
 (0)