jakartaee / jakartaee/jsonb-api

Clarification: What means the word "mappable" for adapters?

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

Description

**Given** the following adapter is part of JSON-B configuration:
```java
class MyCustomAdapter implements JsonbAdapter {
@Override public Y adaptToJson(X obj) throws Exception { ... }
@Override public X adaptFromJson(Y obj) throws Exception { ... }
}
```
**When** `Y` is `String` **then** Johnzon 1.2.1 uses this adapter to deserialize an instance of `X`. 👍
But **when** `Y` is `URI` **then** Johnzon 1.2.1 fails with the following exception: `Missing a Converter for type class X to convert the JSON String '...' . Please register a custom converter for it.` 👎

The JSON-B specification says: "*The target type could be string or some **mappable** java type.*"

IIUC Team Johnzon then their opinion is that this is not clearly a bug in Johnzon (AFAIK because Johnzon *passes* TCK), but there has to be a clarification of the question: Which classes are meant with "mappable"?
* Only `String` and `JsonbObject`?
* Only those classes explicitly mentioned by chapter 3.4 of the JSON-B specification?
* All classes which are *effectively* mappable, u. e. even unmappable classes for which a custom adapter is explicitly provided in the configuration (hence, building a chain of adapters)?
* Something else...?

For providers of applications and custom components the clarification of this question is essential, otherwise it would be impossible to provide *portable* adapters.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the JSON-B specification wording on “mappable” types, especially chapter 3.4, and compare it with the reported Johnzon 1.2.1 behavior for String and URI adapters. Done means the specification clearly defines which adapter target types are portable and resolves whether custom adapter chaining is supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.