Skip to content
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

Unexpected validation error on consumes/produces with external references #22

Open
giuliopulina opened this issue Jun 17, 2019 · 2 comments

Comments

@giuliopulina
Copy link
Contributor

giuliopulina commented Jun 17, 2019

Hi all,

while working on OAI/OpenAPI-Specification#21 I discovered a possible issue with consumes/produces validation.
What I'm trying to do is:

  1. using a valid OpenApi 2.0 spec file ('swagger-editor-external-ref-definition-imported.yml', that's the Uber API)
  2. Importing some definitions from above file in another spec file ('swagger-doc-external-ref-definition.yml').

I'm getting an unexpected error during validation:
[SemanticError at paths./test.get: 'produces' must be equal to 'produces: []', SemanticError at paths./test2.get: 'produces' must be equal to 'produces: []']

I'm afraid I need to change the 'imported' file to make this work, but I think it's not correct (and, often, in real life you can't really do that).

Furthermore, I came across this recent discussion about semantic validation in OpenAPI (OAI/oascomply#54) and there's no mention about consumes/produces validation (except this one: "Parameters with type of file must have a consumes of multipart/form-data or application/x-www-form-urlencoded").
Is it possible that the validation that has been introduced is too strict and not conforming to the OpenAPI 2.0 spec?

@oyeli can you maybe help on this?
You can find failing tests and test files in my branch: https://github.com/giuliopulina/swagger-validator-maven-plugin/tree/bugfix/Issue-21_external_ref_with_no_dot_not_working

@kh0ma
Copy link

kh0ma commented Jun 25, 2019

I can help with it. Because unfortunately, @oyeli doesn't have enough time.

@giuliopulina I have two approaches on how to deal with it:

  1. Disable this validation at all.
  2. Implement "disabling" functionality to explicitly disable some validator from maven configuration.

What do you think about it?

@giuliopulina
Copy link
Contributor Author

Hi @kh0ma, thanks for helping :)
I thought about it, and I would go for solution 1 because the additional validation is breaking some functionalities that, in my opinion, should work without additional configuration.
If you need this validation for your project (and you're not using external references, or you can adapt imported files) you can still implement it as a custom validator.

What do you think about it?
I can manage to do the code change in my branch, but I would be glad if you can review the change once I create the pull request

giuliopulina referenced this issue in giuliopulina/swagger-validator-maven-plugin Jun 27, 2019
…ak with external references and valid media types
giuliopulina referenced this issue in giuliopulina/swagger-validator-maven-plugin Jun 28, 2019
…ak with external references and valid media types
giuliopulina referenced this issue in giuliopulina/swagger-validator-maven-plugin Jun 28, 2019
…eak with external references and valid media types
giuliopulina referenced this issue in giuliopulina/swagger-validator-maven-plugin Nov 23, 2022
…eak with external references and valid media types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants