Skip to content

Cannot pass the required validation of the field which has default value after the Reset button pushed #8217

@keigo-brook

Description

@keigo-brook

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Version: 106.0.5249.91 (Official Build) (arm64)
  • Method of installation: npm
  • Swagger-UI version: 4.14.2
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.1
info:
  title: Swagger Petstore
  version: 1.0.0
tags:
  - name: pet
    description: Everything about your Pets
paths:
  /pet:
    post:
      tags:
        - pet
      operationId: addPet
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/BodyParameter'
        required: true
      responses:
        405:
          description: Invalid input
          content: {}
components:
  schemas:
    BodyParameter:
      required:
        - bodyParameter
      type: object
      properties:
        bodyParameter:
          type: string
          default: default

Swagger-UI configuration options:

window.onload = function() {
  window["SwaggerUIBundle"] = window["swagger-ui-bundle"]
  window["SwaggerUIStandalonePreset"] = window["swagger-ui-standalone-preset"]
  // Build a system
  const ui = SwaggerUIBundle({
    url: "./test.yaml",
    dom_id: "#swagger-ui",
    presets: [
      SwaggerUIBundle.presets.apis,
      SwaggerUIStandalonePreset
    ],
    plugins: [
      SwaggerUIBundle.plugins.DownloadUrl
    ],
    // requestSnippetsEnabled: true,
    layout: "StandaloneLayout"
  })

  window.ui = ui
}

Describe the bug you're encountering

I cannot pass a required validation of the field which has a default value after clicking the Reset button

To reproduce...

  1. push Try it out
  2. edit Request Body parameter
  3. push Reset
  4. push Execute
  5. see validation error although the input field is reseted and has default value

Expected behavior

pass the validation

Screenshots

swagger-request-body

Additional context or thoughts

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