Skip to content

Parsing of boolean additonalProperties inconsistent with OpenAPI 3.0.0 specification #499

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

Closed
mbeko opened this issue Aug 17, 2017 · 10 comments

Comments

@mbeko
Copy link

mbeko commented Aug 17, 2017

I'm used to setting "additionalProperties": false from JsonSchema, hence did so in an OpenAPI 3.0.0 file, especially as it's allowed by the specification.

Using version 2.0.0-SNAPSHOT of swagger-parser-v3 as found on oss.sonatype.org for OpenAPI file validation, I get a parse result message saying that additonalProperties is not of type object.

I'm aware of issue #366, but I think either

  • the parser should accept boolean values for additionalProperties as well
    or
  • it must be clearly stated in the specification if the parser is supposed to frown upon such values.

In addition, the message is a bit misleading because it is reported only once and only for the top level of the object definiton, even though there were several occurences of "additonalProperties": false on deeper levels of this definition. Providing a more precise location would have helped a lot with debugging this issue.

@webron
Copy link
Contributor

webron commented Aug 17, 2017

Thanks for the feedback, @mbeko. The parser should definitely allow it.
Can you provide us with a sample spec to help test it?

Better yet, if you can submit a PR (against the 2.0 branch) adding a test to the test suite, we'll make sure it passes.

@mbeko
Copy link
Author

mbeko commented Aug 17, 2017

Great, thanks! I'll reduce my specification to a minimal example exposing the problem and submit a pull request.

Since I should do it against the 2.0 branch: Should I keep the specification in the 3.0.0 format or rewrite it as 2.0?

@webron
Copy link
Contributor

webron commented Aug 17, 2017

Should be 3.0.0.

2.0 did not allow boolean values to additionalProperties.

@slinkydeveloper
Copy link
Contributor

slinkydeveloper commented Nov 28, 2017

Any news about that bug on OAS 3?

@mbeko
Copy link
Author

mbeko commented Nov 28, 2017

I have added the sample specification and the test, but haven't received feedback since then.

Concerning news about the overall adaptation of the tools to 3.0.0, issue #4669 on swagger-codegen indicates that it lags behind the specification.

@webron
Copy link
Contributor

webron commented Nov 28, 2017

Sorry about this - just got lost in the mass emails. We'll try to take a look shortly.

@mbeko
Copy link
Author

mbeko commented Nov 29, 2017

No problem and thank you 🙂

@slinkydeveloper
Copy link
Contributor

There's a chance to get this fix on upstream before end January? 😄

@gracekarina
Copy link
Contributor

Hi, please checkout the last RC, this was covered there.

@twof
Copy link

twof commented Nov 25, 2019

Hi! This bug appears to have returned in a recent release of swagger-parser. I'll open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants