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

Add config options to generate Joda LocalDate and LocalTime #298

Closed
brentsowers1 opened this issue Mar 3, 2015 · 2 comments
Closed

Add config options to generate Joda LocalDate and LocalTime #298

brentsowers1 opened this issue Mar 3, 2015 · 2 comments
Milestone

Comments

@brentsowers1
Copy link
Contributor

There is a really useful feature currently in place where the generated class property will be LocalDateTime when the JSON schema type is string with format of date-time (implemented in https://github.com/joelittlejohn/jsonschema2pojo/blob/a0797e0878dc46f174b64643bc09655b22983afb/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/FormatRule.java). I'd like to propose generating a LocalDate when the format is date, and LocalTime when the format is time. I see date and time listed in that file explicitly being set to a type of string, so I am guessing that this was thought about at at least some point?

If you think this is a good idea I will take care of implementing it and issuing a pull request, I just wanted to propose it here to make sure it makes sense before starting work.

For the implementation, I would follow the pattern that has been implemented for date-time. I'd add a new config flag for whether or not to use Joda LocalDate and LocalTime (separate from the current flag for whether to use Joda DateTime), defaulting to false.

@joelittlejohn
Copy link
Owner

Hi Brent. This sounds like a good addition, thanks for raising this. Happy to accept a pull request along the lines you have suggested (useJodaLocalDates).

I assume the Joda serializer for Jackson can support LocalDate and LocalDateTime?

@joelittlejohn joelittlejohn changed the title Generate Joda LocalDate and LocalTime Add config options to generate Joda LocalDate and LocalTime Mar 6, 2015
@joelittlejohn joelittlejohn added this to the 0.4.9 milestone Mar 6, 2015
@joelittlejohn
Copy link
Owner

Closed by #300

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

2 participants