-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Jackson enum value is not used if @JsonValue is on an enum field or nonpublic method #3998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
And also @JsonValue not used when on interface method declaration. public interface ErrorCode {
@JsonValue
String code();
}
public enum Code implements ErrorCode {
SOME_ERROR_CODE("actual_error_code");
private final String code;
Code(String code) {
this.code = code;
}
@Override
public String code() {
return code;
}
} |
…rivate methods
Had the same issue. Making the |
…rivate methods
@frantuma Do you remember why you switched to |
When Jackson's
@JsonValue
is used on a public enum method, the Swagger enum list properly uses this value (thanks to #3553). However, when it is used on an enum field instead, or on a non-public enum method, the Swagger enum list does not. This causes a discrepancy between what the REST API actually accepts (as defined by Jackson) and what the Swagger definition states it does.A real quick way to verify this is to update the
JacksonValueEnum
in theswagger-core
test. TheEnumPropertyTest.testExtractJacksonEnumFields
test will then fail.OR
The text was updated successfully, but these errors were encountered: