jakartaee / jakartaee/jsonb-api
@JsonbProperty on boolean field not resolved correctly
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 95
- Forks
- 41
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 35
Description
I'm migrating from JAX-B (+Jackson Binding) to JSON-B (Yasson) and found a possible issue concerning the processing of the @JsonbProperty(value = "...") in some special cases.
Simplified I have POJOs with the following:
@JsonbProperty(value = "myBool")
private boolean isSomething;
public boolean isSomething() {
return isSomething;
}
public void setSomething(boolean isSomething) {
this.isSomething = isSomething;
}
The getter and setter are generated automatically by the IDE or lombok in this way. In this case, the getter is named in the same way as the field (isSomething) as you see.
When I process that with Yasson, I get something like this:
{..., "something":true, ...}
But I want it to be
{..., "myBool":true, ...}
Bug or Feature?
I attached some test to reproduce it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached SamplePojo.java.txt and SamplePojoTest.java.txt, using pom.xml.txt to identify the JSON-B/Yasson setup. Run the reproduction and inspect how the boolean field and accessor are resolved. Done means serialization uses the @JsonbProperty value "myBool" instead of "something".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100