Skip to content

Multiple examples inside schema #10503

@msosnicki

Description

@msosnicki

Context

OpenAPI spec 3.1 announced support for multiple examples inside a schema (not to be confused with multiple examples for request/response which has been supported for a while now).
I was trying to check out how this feature looks like, but it seems is not yet supported by SwaggerUI latest version (5.2.4 as of now).

Specs

The following, single example syntax is supported at 3.0.2:

components:
 schemas:
   Cat:
     type: object
     required: [name, livesLeft]
     properties:
       name:
         type: string
       livesLeft:
         type: integer
     example:
       name: Grumpy
       livesLeft: 2

It renders

Image

However, if I try to switch to 3.1.0 and use multiple examples

components:
  schemas:
    Cat:
      type: object
      required: [name, livesLeft]
      properties:
        name:
          type: string
        livesLeft:
          type: integer
      examples:
        - name: Grumpy
          livesLeft: 2
        - name: Felix
          livesLeft: 3

the following is rendered

Image

Which is incorrect, as it looks as if Examples was a property of a Cat object.

Are there any plans to add support for this feature? Thanks

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