Skip to content

Multiple examples are concatenated with no separator #316

Description

@IMSoP

Description

As of OpenAPI Explorer 2.1.660, an examples array inside a schema element is displayed in the "Model" tab for that schema.

Looking at the history of that release, this may have been a side effect of another feature, but in general it's a good thing: that's useful information which was previously not being displayed at all.

However, the display doesn't currently put any separator between the entries in the array, so they end up glued together in one unreadable string. They should probably be displayed as a pipe-separated list, similar to the allowed values of an enum, and perhaps the label could change from "Example" to "Examples" when there is more than one.

Sample schema

openapi: 3.1.0
info:
  title: Minimal Exmaple
  description: |
    A very minimal schema to demonstrate a bug
  version: 1.0.0
paths:
  /yum:
    get:
      summary: Yummy fruit
      description: Delicious fruit
      operationId: nom-nom
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  variety:
                    type: string
                    description: What kind of fruit?
                    examples:
                      - apple
                      - banana
                      - pear
                      - pineapple

Current Output

Rendered with OpenAPI Explorer 2.4.820, using default options and styling, captured in Firefox 155

Image

Suggested Output

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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