Search code examples
swaggerswagger-uiopenapi

OpenAPI query parameter description not set to text box as placeholder


I have used description to add details for query parameter like

"parameters": [                 
                {
                    "name": "role",
                    "in": "query",
                    "required": true,
                    "schema": {
                        "type": "string"
                    },
                    "description": "This is test description to reproduce placeholder not fit to textbox"                       
                }]

When I load openapi.json to swagger it shows description as well as in text box placeholder. Is there any way to add separate text for placeholder or any way to fix show all text in placeholder? Here text is stripped

enter image description here


Solution

  • If the parameter has an example or default value (or x-example in OpenAPI 2.0), Swagger UI will use this value as a placeholder instead.

    Swagger UI uses the parameter's example value as an input placeholder

    Otherwise, as you've noticed, the placeholder text will be the same as the parameter's description.

    There's an existing feature request to remove or improve the default placeholder text:
    https://github.com/swagger-api/swagger-ui/issues/3920