eclipse-ee4j / yasson

Eclipse Yasson project
https://projects.eclipse.org/projects/ee4j.yasson
Other
204 stars 96 forks source link

Recognize or honor @JsonbProperty annotation when applied to enumerated types. #616

Open api-from-the-ion opened 1 year ago

api-from-the-ion commented 1 year ago

As mentioned here https://github.com/jakartaee/jsonb-api/issues/255, and likely implemented in Johnzon as of https://issues.apache.org/jira/browse/JOHNZON-321, the @JsonbProperty annotation isn't recognized right now on the enum entries. So one need a custom adapter or serilizer / deserliser.

Is it possible to implement it directly? So one only need to use the annotation inside the enum directly, and nothing more?

I think about something like:


public enum Colors {

    @JsonbProperty("Red")
    RED,
    @JsonbProperty("Green")
    GREEN
}```