jakartaee / jakartaee/jsonb-api

Add JsonbEnumValue annotation for enumerated types

Open
#255 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
95
Forks
41
Avg merge
1d 6h
Merged PRs (30d)
35

Description

Json-b presently does not appear to recognize or honor `@JsonbProperty` annotation when applied to enumerated types. We suggest adding an annotation type that implements the same logic as `@XmlEnumValue`

Without this function a custom type adapter is required for all enumerated types with non-Java characters (e.g. '-') in their names. For example, the first entry in the following enum requires a dash instead of underscore. @JsonbProperty is presently not picked up or recognized.

```java
public enum foo {
@JsonbEnumValue("A256CBC-HS512")
A256CBC_HS512,
A128GCM;
}

Thanks!

Referencing [https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/annotation/XmlEnumValue.html](XmlEnumValue)

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing JsonbProperty annotation behavior and the referenced XmlEnumValue API. Define the proposed JsonbEnumValue annotation and confirm how it should map enum constants containing characters such as hyphens; done means the API expresses this mapping consistently and its behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.