swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Even if 'Try it out' is not clicked enum string values are enabled

Open leseb83 opened this issue 7 years ago • 3 comments

Q&A (please complete the following information)

  • OS: Windows
  • Browser: Chrome
  • Version: latest
  • Method of installation: dist assets
  • Swagger-UI version: 3.23.6
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

We have the following configuration for the 'sort' parameter:

in: query
name: sort
description: 'Desc'
schema:
    type: string
     default: name
     enum: [name,createDate,updateDate]

image

All other entries but enum string are disabled as expected.

Describe the bug you're encountering

Until you press the "Try it out' all fields are supposed to be disabled.

To reproduce...

See above

leseb83 avatar Aug 26 '19 14:08 leseb83

Interesting.

@leseb83, can you provide a full OpenAPI document we can use to reproduce this?

shockey avatar Aug 26 '19 23:08 shockey

@shockey, hi, here is a sample.

{
  "openapi": "3.0.1",
  "info": {
    "title": "Test API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "/api/1"
    }
  ],
  "paths": {
    "/fooservice": {
      "get": {
        "summary": "Get Web service",
        "parameters": [
          {
            "in": "query",
            "name": "sort",
            "description": "Desc",
            "required": false,
            "schema": {
              "type": "string",
              "default": "name",
              "enum": [
                "name",
                "createDate",
                "updateDate"
              ]
            }
          },
          {
            "in": "query",
            "name": "asc",
            "description": "Desc 2",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The service has been called with success.",
            "content": {
              "application/json": {}
            }
          },
          "400": {
            "description": "Invalid data provided."
          }
        }
      }
    }
  },
  "security": [
    {
      "basicAuth": []
    }
  ]
}

leseb83 avatar Aug 27 '19 07:08 leseb83

Fixed! 😄

shockey avatar Sep 11 '19 05:09 shockey