Skip to content

OAS3 request bodies without "examples" display an empty "Examples" combobox #5455

@hkosova

Description

@hkosova

This issue was originally reported on Stack Overflow.

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: any
  • Method of installation: https://editor.swagger.io
  • Swagger-UI version: 3.23.0
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.2
info:
  title: test
  version: 1.0.0
paths:
  /foo:
    post:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Foo'
      responses:
        201:
          description: Created

components:
  schemas:
    Foo:
      type: object
      properties:
        foo:
          type: string
          example: bar

Describe the bug you're encountering

The "Request body" section displays an empty "Examples" combobox in addition to the auto-generated examples. The issue was introduced in v. 3.23.0 by /pull/5427.

Expected behavior

No "Examples" combobox - because the request body does not have examples.

Screenshots

Empty "Examples" combobox in the "Request body" section

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions