The request model of the REST API has one enum field:
public enum CommentContext {
STUDENT_FEEDBACK,
STUDENT_QUESTION;
}
Now I want to remove the STUDENT_ prefix from the enum value, but without breaking existing callers of the API.
I tried to use @JsonAlias, like this:
public enum CommentContext {
@JsonAlias ("{FEEDBACK, STUDENT_FEEDBACK}")
FEEDBACK,
@JsonAlias ("{QUESTION, STUDENT_QUESTION}")
COMMENT;
}
But the API is failing with 400 Bad Request, when STUDENT_FEEDBACK is passed as the value of that enum field in the request JSON.
Is it possible to deserialize this CommentContext object from JSON for either of the alternative values of this enum field such as FEEDBACK or STUDENT_FEEDBACK?