Support "format" in ApiModelProperty and correct default Date format
See original GitHub issueSee specification for Data Types
Primitives have an optional modifier property: format
This would be very usefull for Date
as it will be transported as “string”.
So please add format
property to ApiModelProperty
.
Example class:
class Event {
@ApiModelProperty({ format: 'password' })
mySecret: string;
@ApiModelProperty()
myDate: Date;
}
should generate:
"definitions": {
"Event": {
"type": "object",
"properties": {
"mySecret": { "type": "string", "format": "password" },
"myDate": { "type": "string", "format": "date-time" } // Date schould get this format by default
}
}
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:7 (1 by maintainers)
Top Results From Across the Web
java - swagger date field vs date-time field - Stack Overflow
Date is that it's really a date-time, and swagger correctly ... Then, when scanning, swagger will detect this as a date formatted string....
Read more >ApiModelProperty (swagger-annotations 1.5.0 API)
A sample value for the property. ... To set a minimum/maximum value, use the same format for range but use "infinity" or "-infinity"...
Read more >Setting Example and Description with Swagger - Baeldung
If our models contain fields like date, time, or price, an exact value format is necessary. Defining the format beforehand makes the development ......
Read more >Default Date Format? - ServiceNow Community
Hi Shoeb,. If you want different different time formats for 2 different profiles then you can go to Profile A under Self Service...
Read more >OpenAPI 3 Library for spring-boot
To default set parameters to form data when specifying api to accept form data. 5.2. swagger-ui properties. The support of the swagger-ui ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@xmlking try to use
@ApiModelProperty({type: 'string', format: 'date-time'}) dateField: Date;
@ApiModelProperty({ type: Date, format: 'date-time'})
still generateObject
!