-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Date format too strict #507
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
Comments
@tadhgpearson - thanks for opening the ticket. Just want to add that the definition of |
Thanks Ron. The main issue with this for us is date parsing in the client libraries for Swagger Generator. |
I don't see any option to globally change date format presented by Swagger too. For example we are always serializing dates always full offset for timezone, for example "+00:00" or "+02:00". It's still ISO-8601 compliant and we would like to show this format in examples, not with "Z". |
@m-radzikowski - Indeed, this is something else that we find. No-one wants times in UTC. Local time + timezone is king. Neither of these are supported by Swagger formats now, so we just say type: string and try our best to document the format in the description :/ |
BTW - there's nothing preventing the definition of another format. For example, format: iso-date-time could define any ISO 8601 date time as valid. JSON schema does let you define your own formats - if the tool doesn't understand a given format it should flag all values as 'valid', so all you need is that the tools you need to support your formats Of course, having it in the spec would speed up adoption ;) |
Tackling PR: #741 |
We support |
@fehguy - I guess what would be useful is most languages have a date/time library that supports ISO 8601 dates. It would be useful to have a format, like |
We've discussed in the past the option to have as part of the OAI, a Keeping it inside and as part of the spec is ill-advised as it will make constant changes to the spec, bumping minor versions needlessly. As such, I'd suggest keeping the minimal list we have now, and keep exploring the registry idea in the future. More information can be found in #845. In fact, I'll close this ticket as we now have a reference between the two. |
One can allow in both date and date-time values with:
|
Swagger dateTime format requires use of the RFC date-time format which is a subset of the ISO Datetime format that does not leave minutes and seconds as optional.
I'm working on APIs for the Travel Industry, where things are never scheduled to the second. Most flights and trains operate to minutes, most car rentals work to the nearest hour. I don't want to compromise my APIs to deliver meaningless minutes and seconds values just to please Swagger.
See https://groups.google.com/forum/#!topic/swagger-swaggersocket/S3ehhOPqink
The text was updated successfully, but these errors were encountered: