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

Should not document examples for non-schema parameters #884

Open
spaceraccoon opened this issue Nov 15, 2022 · 0 comments
Open

Should not document examples for non-schema parameters #884

spaceraccoon opened this issue Nov 15, 2022 · 0 comments

Comments

@spaceraccoon
Copy link
Contributor

As documented in the OpenAPI v2 spec, the example keyword only appears in schema objects and not parameter objects. If the example keyword appears in a parameter object, the OpenAPI validator returns the following error:

Structural error at paths./api/test
should NOT have additional properties additionalProperty: example

The root cause is that document_example adds the example keyword without check if the parameter is a schema/body type:

        def document_example(settings)
          example = settings[:example]
          @parsed_param[:example] = example if example
        end
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

1 participant