jakartaee / jakartaee/jsonb-api

Support AnnotatedType

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

Description

Since Java 8 introduced TYPE_USE annotations, and this API is a Java standard as well, one would expect the two to work together.

I suggest JSON-B is enhanced (the implementation at least, if not the spec) to support `AnnotatedType`.

Namely, the following methods should exist:
* `Jsonb#fromJson(String, AnnotatedType)`
* `JsonbDeserializer#deserialize(JsonParser, DeserializationContext, AnnotatedType)`

The rationale is that the deserializer gains the ability to make decisions based on the type annotations.

E.g.
For a type such as `List<@Base64 Key>` it would be possible to create a (de)serializer that performs custom logic (e.g. Base64-encode/decode the value on the way in/out) for types annotated with `@Base64` regardless of their class.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by reviewing the Jsonb and JsonbDeserializer API definitions and determine whether support belongs in the specification, implementation, or both; done means the proposed AnnotatedType methods are defined and type annotations can guide deserialization, with tests covering the stated List<@Base64 Key> example.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.