-
Couldn't load subscription status.
- Fork 2.2k
Closed
Description
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 the swagger-core test. The EnumPropertyTest.testExtractJacksonEnumFields test will then fail.
public enum JacksonValueEnum {
FIRST("one"),
SECOND("two"),
THIRD("three");
@JsonValue
private final String value;
JacksonValueEnum(String value) {
this.value = value;
}
}OR
public enum JacksonValueEnum {
FIRST("one"),
SECOND("two"),
THIRD("three");
private final String value;
JacksonValueEnum(String value) {
this.value = value;
}
@JsonValue
private String getValue() {
return value;
}
}vioao, jadrovski, fbo3264, alexgentile and rusxakep
Metadata
Metadata
Assignees
Labels
No labels