swagger-api / swagger-api/swagger-inflector
DateTime example value drops seconds part
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 172
- Forks
- 85
- Avg merge
- 58m
- Merged PRs (30d)
- 2
Description
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-offsetdate-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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ExampleBuilder entry point and inspect how OffsetDateTime.toString() produces date-time examples. Compare the generated value with RFC3339 section 5.6 and the documented date-time format. Done means generated examples always include the required seconds component and remain valid date-time values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100