-
-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YAML type coercion in description documents #1016
Comments
Which YAML parser and version are you using? |
Python3 - PyYAML 6.0 I do not consider this a problem with the YAML parser, from my understanding the parser does things according to the specification. To me this is a problem of the description document not forcing this to be a string either enclosing in "" or via !!str. I consider the dd invalid by having datetime objects where string is expected. |
Do you know if pyYAML supports YAML 1.2 or 1.1 only? |
These documents are YAML 1.2, as recommended by the OpenAPI Specification:
As we basically have no control over the YAML output by our chosen yaml parser, I'm unfortunately going to close this as not-a-bug. |
YAML 1.2 does not change anything here. As an example, ruamel.yaml does YAML 1.2: from ruamel.yaml import YAML
yaml = YAML()
yaml.load("example: 2020-06-11T16:32:50-03:00")
# ordereddict([('example', TimeStamp(2020, 6, 11, 19, 32, 50))]) example expects string. This makes this not a valid description document? |
From https://yaml.org/spec/1.2.2/ext/changes/
|
Seems I'm all wrong with this one. |
It doesn't help that the YAML 1.2 spec contains three (orphan?) references to !! timestamp without explicitly referencing where it comes from. |
Closing due to inactivity - but please feel free to chase and we can reopen the issue if necessary. |
Due to yaml type coercion certain values get converted to objects.
E.g. timestamps to datetime objects:
Therefore I'd like to have your opinion in having such values in a description document, such as:
openapi-directory/APIs/1password.com/events/1.0.0/openapi.yaml
Lines 176 to 179 in 3b42800
openapi-directory/APIs/amadeus.com/2.2.0/openapi.yaml
Lines 54 to 56 in 3b42800
openapi-directory/APIs/api.video/1/openapi.yaml
Lines 76 to 84 in 3b42800
openapi-directory/APIs/apidapp.com/2019-02-14T164701Z/openapi.yaml
Lines 4 to 8 in 3b42800
openapi-directory/APIs/apideck.com/accounting/8.32.1/openapi.yaml
Lines 4720 to 4722 in 3b42800
The text was updated successfully, but these errors were encountered: