You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JsonEnum deserialization employs a lookupTable, which is a Map<String, T>.
In the deserialize method, the corresponding enumeration is obtained through the method this.lookupTable.get(value).
A problem arises regarding the case sensitivity of strings:
If the value in the enumeration class is lowercase, and uppercase letters are used in the DSL, an error will be reported. However, the DSL permits the use of uppercase letters. This can be quite confusing for developers.
How can one reproduce the bug?
Taking ZerotermsQuery as an example:
@JsonpDeserializable
public enum ZeroTermsQuery implements JsonEnum {
All("all"),
None("none");
private final String jsonValue;
public static final JsonEnum.Deserializer<ZeroTermsQuery> _DESERIALIZER = new JsonEnum.Deserializer(values());
private ZeroTermsQuery(String jsonValue) {
this.jsonValue = jsonValue;
}
public String jsonValue() {
return this.jsonValue;
}
}
That will be thrown JsonparsingException when executing the anti sequence method.
public T deserialize(String value, JsonParser parser) {
T result = (JsonEnum)this.lookupTable.get(value);
if (result == null) {
throw new JsonParsingException("Invalid enum '" + value + "'", parser.getLocation());
} else {
return result;
}
}
What is the expected behavior?
case-insensitive.
What is your host/environment?
Operating system, version.
Do you have any screenshots?
If applicable, add screenshots to help explain your problem.
Do you have any additional context?
Add any other context about the problem.
The text was updated successfully, but these errors were encountered:
What is the bug?
JsonEnum deserialization employs a
lookupTable
, which is aMap<String, T>
.
In the
deserialize
method, the corresponding enumeration is obtained through the methodthis.lookupTable.get(value)
.
A problem arises regarding the case sensitivity of strings:
If the value in the enumeration class is lowercase, and
uppercase
letters are used in the DSL, an error will be reported. However, the DSL permits the use of uppercase letters. This can be quite confusing for developers.How can one reproduce the bug?
Taking
ZerotermsQuery
as an example:DSL:
That will be thrown
JsonparsingException
when executing the anti sequence method.What is the expected behavior?
case-insensitive.
What is your host/environment?
Operating system, version.
Do you have any screenshots?
If applicable, add screenshots to help explain your problem.
Do you have any additional context?
Add any other context about the problem.
The text was updated successfully, but these errors were encountered: