-
Notifications
You must be signed in to change notification settings - Fork 8
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 OpenAPI format/profile #27
Comments
I worked a bit with OpenAPI, but I'm not uptodate. That said,
Yes, YAML::PP implements all 3 schemas from 1.2 (Failsafe, JSON and Core).
So anything that is not null, boolean or a number, needs to be quoted. To use the JSON Schema: This is actually the current default, but I decided that it was not a good decision. The Core schema should be the default, because that will be compatible to most other YAML processors that implement 1.2. Some of them only implement the Core Schema. (I want to change it and hope I can do that soon and not too much users really depend on the default right now...)
This is not something you can restrict YAML::PP to without being prepared for changes. You can already add some callbacks to influence the loading process, but it's still in the works, and overriding the hash construction is probably something that will change.
You mean dumping an OpenAPI specification to YAML? Only with the first constraint currently. I'm always happy to hear about new use cases. So far only one CPAN project I know of is using the tag resulution/callback API. |
Another comment about this: The Failsafe schema does not restrict mapping keys to only scalars.
So I find this rule a bit confusing. |
Primary use case is: We have already find out that e.g. Python YAML parser has problems with somekey:
- yes
- value should be interpreted as I do not know if there can be other problems, but booleans and unquoted literals are the first thing which started causing problems in more languages when we were trying to load OpenAPI 3 YAML files. |
Yes, Python's PyYAML implements only the YAML 1.1 types, so it cannot be used for this. You can try the alternative ruamel.yaml. Besides booleans and null values, also the regular expressions for numbers are different between the YAML 1.2 Core and JSON schema. |
Ok, thank you very much for information. |
Hello! I would like to ask some information about YAML::PP and OpenAPI YAML files.
OpenAPI specification is at website https://swagger.io/specification/ and says that it uses YAML 1.2 format with some constrains:
Can YAML::PP parse these YAML files with above constrains correctly?
And could be YAML::PP configured to generate YAML file from Perl structure according to these constrains?
The text was updated successfully, but these errors were encountered: