You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Above sample YAML file is actually generated from Java code using MicroProfile framework inside Open Liberty web application server.
Describe the bug you're encountering
Example value of date property is not rendered correctly when provided as timestamp value. Only strings (quoted or double-quoted) are rendered as expected.
This is because our YAML parser (js-yaml) is converting your example value to a JavaScript Date object, which you see as an empty object ({}).
This is in line with the YAML spec, which calls for scalar values that don't explicitly label what type they are to be resolved based on their value:
[Plain scalars] may be matched against a set of regular expressions to provide automatic resolution of integers, floats, timestamps, and similar types. An application may also match the content of mapping nodes against sets of expected keys to automatically resolve points, complex numbers, and similar types.
If you'd like to avoid this, any of these formats for your example will solve this:
example: "2012-01-01"
example: !!str 2012-01-01
Alternatively, if you remove your example field entirely, the latest version of Swagger Editor should automatically generate an example value for you based on the current date.
This is simply to keep our issue tracker clean - feel free to comment if there are any further thoughts or concerns, and we'll be happy to reopen this issue.
Q&A (please complete the following information)
Content & configuration
Example Swagger/OpenAPI definition:
Above sample YAML file is actually generated from Java code using MicroProfile framework inside Open Liberty web application server.
Describe the bug you're encountering
Example value of date property is not rendered correctly when provided as timestamp value. Only strings (quoted or double-quoted) are rendered as expected.
To reproduce...
Steps to reproduce the behavior:
Expected behavior
I would expect to see the date that is provided in OpenAPI definition.
Screenshots
Additional context or thoughts
See the stackoverflow question that pointed to creation of this issue.
The text was updated successfully, but these errors were encountered: