jakartaee / jakartaee/jsonb-api

ZoneId serialization

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

Description

According to the JSON-B specification a `java.time.`ZoneId instance needs to be serialized as follows (emphasis mine):

> Implementations MUST support the deserialization of any time zone ID format specified in java.time.ZoneId into a field or property of type java.time.ZoneId. The serialization format of java.time.ZoneId is the normalized zone ID as specified in java.time.ZoneId.

The normalized part makes a difference when you have a `ZoneId.of("UTC")`, for example. The zone ID is "UTC", but the normalized zone ID is "Z", as shown by this jshell session:

```
jshell> import java.time.*;

jshell> ZoneId.of("UTC").getId()
$2 ==> "UTC"

jshell> ZoneId.of("UTC").normalized().getId()
$3 ==> "Z"
```

The TCK test [DatesMappingTest#testZoneIdMapping](https://github.com/eclipse-ee4j/jsonb-api/blob/9c248fe914349d8d1dae7d9f172bb33feb2b9aea/tck/src/main/java/jakarta/json/bind/tck/defaultmapping/dates/DatesMappingTest.java#L466-L469) tests that `ZoneId.of("UTC")` is serialized to `"UTC"`, which is not the normalized zone.

Contributor guide

Open the contributing guide

Research direction

Start with tck/src/main/java/jakarta/json/bind/tck/defaultmapping/dates/DatesMappingTest.java and testZoneIdMapping, then compare its assertion with the quoted JSON-B requirement and ZoneId normalized behavior. Done when the TCK test matches the required serialization behavior and passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.