-
Notifications
You must be signed in to change notification settings - Fork 1
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
error parsing schema file with a minimum value for a number #86
Comments
The thing is that I may have other similar false parsing bugs, but as this object is at the root of the tree of components, it is really difficult to figure out from the limited information in the error if the rest of the tree is failing because this did, or for other reasons as well. I can provide the entire yaml file if you'd like, but I figured a more minimal reproduction might be best to start with. |
I tried reading the spec in several different ways, ultimately settling on a variation of some example code you provided,
|
My next questions will be what perl version you are using, and the module version of whatever is turning the yaml file into a hashref, because that's what's mangling the number(s) in your schema. |
perl 5, version 40 on OSX. the file doing the reading is here (note the branch in that link, the main branch of that repository doesn't have it). the path to the file is constructed at line 75 and the function to read in the file is immediately on the next line. I'm not yet doing anything with the result, I currently still have the code in place using the document_filename parameter instead, but while that doesn't produce any errors, it also results in a program that apparently has an empty configuration object. I'm running this locally with the command
|
as you can see I've tried a few different modules in my quest to first understand and second get something working. I'm fairly sure that most of these are not being loaded though:
|
the hashref would be coming from line 115. that Load function is from |
I added a script file which has just the loading stuff extracted out from the rest of the Web.pm file |
I've also tried |
I changed the loading to
and the Data::Printer output looks like it imported a number to me. |
Ah, you're using YAML::XS. So you're bumping into a parsing problem that it has there, see ingydotnet/yaml-libyaml-pm#110 The workaround, until this is fixed, is to use YAML::PP: You can see the effect of this with:
|
Changing to YAML::PP did indeed get me past any issue. Since this seems to be a known bug with the YAML::XS folks, you can close this as it doesn't seem like there's anything for you to do except maybe document a compatibility limitation? Thanks for the support!! |
Resolved in release 0.594, which is more forgiving of malformed numeric strings. |
given a schema file that has a component that sets a minimum value for something of type number, OpenAPI::Modern will refuse to load it saying "got ambiguous type, not number" on the minimum, then "not all properties are valid" on the object containing it.
openapi.yaml.txt
I reduced my actual API file down enough to show the error fairly clearly without lots of extraneous stuff in it. This API file validates fine with both the SwaggerUI viewer and the ibm-openapi-validator (though it does show some warnings with the latter, it shows no errors).
The text was updated successfully, but these errors were encountered: