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.

Open
#6,791 0 comments 2 reactions 0 assignees View on GitHub

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:

  1. Go to https://editor.swagger.io
  2. Paste yaml
  3. See placeholder not current date,
Expected behavior

Renders current date as default fallback.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.