Skip to content

Should not document examples for non-schema parameters #884

Open
@spaceraccoon

Description

@spaceraccoon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions