Skip to content

Execute button becomes unresponsive when an optional field is omitted #7086

@vy

Description

@vy

Setup

  • OS: Xubuntu 20.04.2 LTS
  • Browser: Brave
  • Version: 1.21.74 Chromium: 89.0.4389.72
  • Method of installation: org.webjars.npm:swagger-ui-dist Maven Artifact
  • Swagger-UI version: 3.42.0, 3.43.0, 3.44.0, 3.44.1, 3.45.0, 3.46.0
  • Swagger/OpenAPI version: Swagger 2.0

Configuration

swagger: '2.0'
info:
  version: '1.0'
  title: v1
tags:
  - name: Order Candidates V1
paths:
  '/v1/order-candidates':
    put:
      tags:
        - Order Candidates V1
      summary: Set order delivery location
      operationId: setDeliveryLocation
      produces:
        - application/json
      parameters:
        - in: body
          name: body
          description: The delivery location for the item.
          required: false
          schema:
            $ref: '#/definitions/OrcaDeliveryLocation'
      responses:
        '200':
          description: successful operation
definitions:
  OrcaDeliveryLocation:
    type: object
    properties:
      pickupLocation:
        $ref: '#/definitions/PickupPointLocation'
  PickupPointLocation:
    type: object
    required:
      - validated
    properties:
      validated:
        type: boolean

Actual behavior

After clicking to Try it out button of PUT /v1/order-candidates method, Swagger auto-fills the body. Clicking on Execute executes the request as expected. When the optional (i.e., not required) pickupLocation entry is removed from the body, clicking on Execute doesn't respond.

Expected behavior

When the optional (i.e., not required) pickupLocation entry is removed from the body, clicking on Execute should execute the request.

Additional context

Issue is reproducible on 3.42.0, 3.43.0, 3.44.0, 3.44.1, 3.45.0, 3.46.0 versions of the Maven artifact. The issue disappears on 3.41.1. As of this date, one can also reproduce the issue using https://editor.swagger.io/ website.

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