swagger-api / swagger-api/swagger-ui
"Try it out" doesn't prompt with form when parameters are a schema
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
The following path used to provide username/password text input fields. In 3.0.2 it now requires the "Example Value" text box to be edited. It looks like this happens when the input parameters are specified using schema.
"/auth/token": {
"post": {
"tags": [
"auth"
],
"summary": "Get an API key",
"description": "",
"operationId": "getApiKey",
"security": [],
"consumes": [
"application/json"
],
"produces": [
"application/json; version=1.0"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "Authentication",
"required": true,
"schema": {
"$ref": "#/definitions/auth_credentials"
}
}
],
"responses": {
"200": {
"description": "Successful Authentication",
"schema": {
"description": "Authorization Result",
"allOf": [
{
"$ref": "#/definitions/Response"
},
{
"properties": {
"result": {
"description": "API Key",
"type": "string",
"example": "example_api-key_iZkjs8-Yc2LzRjpwKbai11kkPZg"
}
}
}
]
}
},
"400": {
"description": "Invalid Format",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"401": {
"description": "Invalid Credentials",
"schema": {
"$ref": "#/definitions/AuthErrorResponse"
}
}
}
}
}
...
"auth_credentials": {
"type": "object",
"properties": {
"username": {
"type": "string",
"minLength": 1,
"title": "Username"
},
"password": {
"type": "string",
"format": "password",
"minLength": 1,
"title": "Password",
"secret": true
}
},
"additionalProperties": false,
"required": [
"username",
"password"
]
},

As an example the following path which does not use schema provides a text input field for name:
"/support_bundles/{name}": {
"delete": {
"tags": [
"support_bundles"
],
"summary": "Delete a single support bundle",
"description": "",
"operationId": "deleteSupportBundle",
"produces": [
"application/json; version=1.0"
],
"parameters": [
{
"name": "name",
"in": "path",
"description": "Name of support bundle",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/Response"
}
}
}
}
},

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named in the issue. Start at the Swagger UI "Try it out" form handling for body parameters with a schema, compare it with the path-parameter example, and verify that schema-defined username/password fields are shown without editing Example Value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100