Fields of format time or date default to "string"
See original GitHub issueQ | A |
---|---|
Bug or feature request? | Bug |
Which Swagger/OpenAPI version? | 3.0.1 |
Which Swagger-Editor version? | Online as of date of post |
How did you install Swagger-Editor? | Online |
Which broswer & version? | Chrome 63.0.3239.84 |
Which operating system? | Windows 10 |
Demonstration API definition
https://gist.github.com/nkolban/fd6aa143ed10af5446fd2950c849e503
Configuration (browser query string, constructor, config.yaml)
Not applicable
Expected Behavior
Here is the example model produced for the operation:
{
"action": "start",
"params": {
"input1": {
"decimalField": 0,
"boField": {
"fieldA": "string",
"fileB": 0,
"fieldC": true,
"anotherBO": {
"x": "string",
"y": "string",
"z": "string"
},
"fieldD": [
"string"
]
},
"booleanField": true,
"integerField": 0,
"timeField": "string",
"dateField": "string",
"anyField": "string",
"stringField": "string"
}
}
}
Note the fields called timeField
and dateField
. These are defined in the JSON Schema as:
timeField:
type: string
format: time
dateField:
type: string
format: date
What I was expecting was that the example fields would be generated as ISO 8601 format strings and not the word string
.
For example,
...
"timeField": "2017-12-09T18:14:01Z",
"dateField": "2017-12-09",
...
Current Behavior
See above.
Possible Solution
Detect that the field is a date or time format field and generate a default ISO 8601 string based on current time.
Context
Am generating OpenAPI descriptions by interrogating existing servers. Goal is for end user to query server which generates OpenAPI which is then copied into Swagger editor for testing. Generated sample data for the payload of the request should not be the word string
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Date and Time Formats - IBM
Format Specifier Format Example
%m/%d/%Y mm/dd/yyyy 02/21/2018
%m/%d/%y mm/dd/yy 02/21/18
%d/%m/%Y dd/mm/yyyy 21/02/2018
Read more >Format a date and time field - Microsoft Support
(Default) Displays date values as numbers and time values as hours, minutes, and seconds followed by AM or PM. For both types of...
Read more >Default Date Format - Informatica Documentation
uses a default date format to store and manipulate strings that represent dates. To specify the default date format, enter a date format...
Read more >Java SimpleDateFormat - Java Date Format - DigitalOcean
DateFormat is used for formatting a date into String based on specific locale that is provided as input. The locale is used for...
Read more >Global date and time field format
You define default date and time formats globally using system properties. Date format. The glide.sys.date_format property defines the date ...
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 Free
Top 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
Thank you sir. I had misread the
time
property … what I mean to use wasdate-time
which does appear to be exposed by OAS.Thank you very much. Everything works as expected!