swagger-api / swagger-api/swagger-ui

Type for "date-time" property is displayed as "string" Instead of "date" even after setting the dataType attribute

Open
#3,286 7 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P2 type: feature version: 3.x
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Hi,

The JSON rendered from Swagger UI displays the type for date-time property as "string". Swagger Documentation states that the type has to be String and doesn't have a special way of showing 'dates' but is there anyway possible that we can change the type from "string" to "date".I have tried hard-coding the type using annotation #@ApiModelProperty(dataType="date") but it didn't work. Is there anyway that we can display the type as "date" instead of "string", and generate default values? Any suggestion for this ?
The comments for the tickets on the same issue #1183 & #462 states that it would be solved in the next version. Can someone let me know if this is resolved ,if yes please let me know the version.

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

No files or tests are identified. Start by reproducing the Swagger UI rendering for a schema property with format "date-time" and review the schema display entry point, including how the dataType annotation is represented. Done means the intended date display and default-value behavior are confirmed or the issue is narrowed to a specific rendering limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.