swagger-api / swagger-api/swagger-ui
Invalid parameters are displayed in UI
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: [e.g. macOS] Windows
- Browser: [e.g. chrome, safari] Firefox
- Version: [e.g. 22] 90.0
- Method of installation: [e.g. npm, dist assets] app.swaggerhub.com
- Swagger-UI version: [e.g. 3.10.0] don't see
- Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0] OpenAPI 3.0.3
Content & configuration
Example Swagger/OpenAPI definition:
openapi: 3.0.3
info:
title: Parameters example
version: 1.0.0
servers:
- url: 'https://127.0.0.1/api/rest'
paths:
'/foo/{bar}':
post:
parameters:
- name: bar
in: header
schema:
type: string
requestBody:
content:
application/json:
schema:
type: string
responses:
'200':
description: Example
content:
application/json:
schema:
type: string
delete:
responses:
'200':
description: OK
parameters:
- required: true
name: bar
in: path
schema:
type: string
Swagger-UI configuration options:
SwaggerUI({
// your config options here
})
?yourQueryStringConfig
Describe the bug you're encountering
Specification says A unique parameter is defined by a combination of a name and location.
I defined bar parameter in path location at PathItem and I defined parameter with same name bar, in header location at Operation.
To reproduce...
Steps to reproduce the behavior:
- Go to app.swaggerhub.com.
- Register and create new API.
- Paste OpenAPI yaml from the example (above).
- See error in POST method: One parameter
barin header location displayed. Nobarin path location parameter.
Expected behavior
Expected two parameters in POST method: bar in path location and foo in header location.
Screenshots
Additional context or thoughts
Related question in OpenAPI-Specification repo.
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
Start by reproducing the supplied OpenAPI 3.0.3 example through the SwaggerUI entry point and inspect how the POST operation renders its parameters. Done means both the path parameter bar and the operation-level header parameter appear, rather than only the header parameter.
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
- 42/100