Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JEE-8 - Json-B support #1053

Closed
cchet opened this issue Dec 5, 2019 · 9 comments
Closed

JEE-8 - Json-B support #1053

cchet opened this issue Dec 5, 2019 · 9 comments

Comments

@cchet
Copy link

cchet commented Dec 5, 2019

Does your library support Json-B or intends to support it?
If you don't or wont support it, how hard is it to get Json-B integrated?

We want to use it because it is the standard way of binding models to Json since JEE-8.

@dewthefifth
Copy link
Collaborator

From what I can tell, you could do this right now with a custom annotator as discussed in #524 . However, I've never used Json-B so I might be missing something.

Your projects decisions are your own to make, but it is worth noting that the already implemented and supported library (jackson) does appear to out perform the JSON-B implementations (both johnzon and yasson) according to https://github.com/fabienrenaud/java-json-benchmark

@joelittlejohn
Copy link
Owner

Since this is now a somewhat 'official' JSON binding API I think we should include a Json-B annotator in this project.

@joelittlejohn
Copy link
Owner

If anyone wants to implement a Json-B annotator and submit a PR then please feel free.

@TheTrueDentist
Copy link
Contributor

I would have usage for JSON-B-support for a project. Any chance that we'll see this feature in future?

@TheTrueDentist
Copy link
Contributor

I've just provided a pull request for this, see: #1385.

A little hint on how to use. JSON-B can map dates and times with apropriate anotation. I've seen listings with Date used as datatype, but they didn't work for me. Instead, LocalDate and the like did do the job. Code generation can already be configured to use them already, so that's what I suggest to do to other users.

Another thing I noticed is that to my knowledge the json schema spec defines time and the time portion of date-time to be in same format by default. Yet the constants in FormatRule are defined differently in this regard, I believe the format in ISO_8601_DATETIME_FORMAT is right. Might need to be fixed, but seemed out of scope for my pull request.

@eirnym
Copy link

eirnym commented Mar 18, 2022

Please note, that LocalDate is java 8+ API while this tool supports generation of java 6 source code. Thus it should be changed or well documented + produce an error when java 6 or 7 was used as a target

@TheTrueDentist
Copy link
Contributor

I don't think I have used LocalDate anywhere in the code. By default, Date should be used. But one could specify LocalDate to be used in the plugin configuration. Ír you are on Java 8+ in your project, that should work while the plugin should remain independent. Although I am not sure if JSON-B will work on Java 6 properly, but that should not affect the plugin.

@joelittlejohn
Copy link
Owner

Closed by #1385.

@TheTrueDentist
Copy link
Contributor

Although the changes are merged to master, there's still no new release, so users can't use the new feature. Are there chances we see the next version any time soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants