swagger-api / swagger-api/swagger-ui
String parameter with format date or date-time should fallback to current date if no example or default is defined.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Content & configuration
Example Swagger/OpenAPI definition:
openapi: 3.0.0
info:
version: "{version}"
title: String parameter with format date or date-time does not render properly
paths:
/test:
get:
parameters:
- in: query
name: afterDate
schema:
type: string
format: date
- in: query
name: afterDateTime
schema:
type: string
format: date-time
responses:
"200":
description: ""
Describe the bug you're encountering
Should use current date for example value. https://github.com/swagger-api/swagger-ui/issues/5061#issuecomment-445286984
To reproduce...
Create string schema with format date or date-time and use it as parameter schema.
Steps to reproduce the behavior:
- Go to https://editor.swagger.io
- Paste yaml
- See placeholder not current date,
Expected behavior
Renders current date as default fallback.
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
Reproduce the issue in https://editor.swagger.io using the provided OpenAPI YAML, focusing on query parameters whose string schemas use the date and date-time formats without an example or default. Trace the parameter rendering path and verify that the displayed fallback is the current date or date-time rather than an empty or incorrect placeholder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100