swagger-api / swagger-api/swagger-ui
Format:date with example renders time in addition to date
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: Windows
- Browser: Chrome
- Version: 72
- Method of installation: visual studio code extension (openapi-designer)
- Swagger-UI version: [e.g. 3.21.0]
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
I use a visual studio extension to render things on the fly (openapi-designer) and have checked that it uses the latest version of swagger-ui
Example Swagger/OpenAPI definition:
startDate:
type: string
format: date
example: 2018-12-25
Describe the bug you're encountering
There was recently a pull request to make automatic example if it is not present. That works fine, but when I have my own example, then the rendered date for some reason includes timestamp as well:
"startDate": "2018-12-25T00:00:00.000Z",
To reproduce...
- Render YAML with type: string and format: date
- Open an example value in the browser
Expected behavior
Expected to see only date in example
"startDate": "2018-12-25",
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 by reproducing the issue with the provided OpenAPI YAML in Swagger UI, following the listed browser steps. Trace the example rendering path for a string with format: date and compare the output with the supplied expected JSON; done means the custom example renders as 2018-12-25 without a timestamp.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100