Markus Karg created JOHNZON-341:
-----------------------------------
Summary: @JsonbProperty MUST NOT serialize NON-PUBLIC fields
according to JSON-B specification
Key: JOHNZON-341
URL: https://issues.apache.org/jira/browse/JOHNZON-341
Project: Johnzon
Issue Type: Bug
Components: JSON-B
Affects Versions: 1.2.10
Reporter: Markus Karg
The JSON-B specification unambiguously defines that @JsonbProperty's sole job
is to define _the name mapping_ of properites, while ONLY PUBLIC fields are to
be actually serialized.
Due to https://issues.apache.org/jira/browse/JOHNZON-100 Johnzon 1.0.9 actually
serializes ALL non-public fields when they are annotated by @JsonbProperty.
As a result, there is a difference between the serialized output of Johnzon and
Yasson (the RI for JSON-B v1). As discussed in
[https://github.com/eclipse-ee4j/jsonb-api/issues/271,] Johnzon's current
behavior is non-compliant to the spec. Also it leads to confusion and possibly
real problems when applications RELY on the serialized form intentionally
OMITTING such fields (e. g. for technical or security reasons).
To overcome the differences in the serialized output between Johnzon and
Yasson, and to have a spec-compliant output produced by Johnzon, a solution is
to be found, e. g. introduction of a configuration option which defines whether
the output is compliant to the spec (only containing PUBLIC fields), or whether
it is like before (containing ALL @JsonbProperty annotated fields).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)