-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support for java Duration #1409
Comments
Should be an easy PR to add. Check out the FormatRule and FormatIT. |
It should be noted though that neither
For example it is not possible to construct
|
@unkish agree. But for the most use cases duration type is good enough. Like default regex implementation as I wrote below. There's way more to add about compliance of Java types to JSON schema standards. E.g. one of such type types is regex: Java's version still support regexes like If parser-specific formatter exists in a parser library, it's better to add an annotation for it. Otherwise, I'd add parser-specific things to a parser or a separate library. |
@unkish It's a good point. I've found that using appropriate types provided by the host platform is most useful, even if they are not strictly compliant. The regex example is a good one. However, in this case, if we don't support |
I'm sorry, maybe I misunderstand what You are trying to hint at. Following code would fail in runtime:
|
Out if interest, does this work: om.readValue("P1Y2M", TemporalAmount.class); ? |
Unfortunately not:
I can't imagine what it would return in case something more complex such as |
Json schema Spec support format duration as this issue mention json-schema-org/json-schema-spec#565
Is it possible to have java time Duration generated for this format, as it the case for uuid format ?
The text was updated successfully, but these errors were encountered: