Skip to content

Multiple example set in OpenAPI schema doesn't work #913

Open
@angeschw

Description

@angeschw

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior.

Create an OpenAPI schema 3.0.0.
Use a repeated component in various responses.

// first path has a response with component
      responses:
        201:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MyRepeatedObject'
              example:
                id: 'mock_id'
                name: 'repeated_object_name'

// a different path later in the same file
      responses:
        200:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MyRepeatedObject'
              example:
                id: 'mock_id_2'
                name: 'repeated_object_name_2'

Actual behavior
A clear and concise description of what happens.

Presence of 1 example builds + validates fine. Presence of 2 example fails with no clear error from express-openapi-validator.
error: {}

Expected behavior
A clear and concise description of what you expected to happen.

Multiple examples should be allowed

Examples and context
An example or relevant context e.g. an OpenAPI snippet, an Express handler function snippet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions