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

DateTime example value drops seconds part #403

Open
WouterLangerak opened this issue Jul 5, 2021 · 0 comments
Open

DateTime example value drops seconds part #403

WouterLangerak opened this issue Jul 5, 2021 · 0 comments

Comments

@WouterLangerak
Copy link

When generating examples with for date-time types with the ExampleBuilder the returned example value does not comply with the format as described in the documentation.

The Data-type documentation references rfc3339 section 5.6 as format for date-time.
This RFC states that time-second is required

partial-time = time-hour ":" time-minute ":" time-second
[time-secfrac]
full-date = date-fullyear "-" date-month "-" date-mday
full-time = partial-time time-offset

date-time = full-date "T" full-time

Swagger uses OffsetDateTime.html#toString() for creating the value of date-time example. This method states it will strip the second part when it is empty.

The output will be one of the following ISO-8601 formats:

uuuu-MM-dd'T'HH:mmXXXXX
uuuu-MM-dd'T'HH:mm:ssXXXXX
uuuu-MM-dd'T'HH:mm:ss.SSSXXXXX
uuuu-MM-dd'T'HH:mm:ss.SSSSSSXXXXX
uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSSXXXXX

This conflicts with the format as state in the data-types documentation.

In stead of toString() a formatted value should be used. For example DateTimeFormatter.html#ISO_INSTANT

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

No branches or pull requests

1 participant