Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters with same name but different locations can't render in UI properly #1816

Closed
hujj-615 opened this issue Aug 25, 2022 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@hujj-615
Copy link

Describe the bug

Define 2 parameter objects with same name but different location, only one can be shown in swagger UI.

To Reproduce

Env: Springboot 2.5.14 + springdoc-openapi-ui:1.6.11

Steps:

  1. Create a simple REST API which just has header and cookie parameters with same name.
@RequestHeader(value = "access_token", required = false) 
@Parameter(name = "access_token", in = ParameterIn.HEADER, description = "token in header", schema = @Schema(implementation = String.class)) 
String tokenInHeader,

@CookieValue(value = "access_token", required = false)
@Parameter(name = "access_token", in = ParameterIn.COOKIE, description = "token in cookie", schema = @Schema(implementation = String.class)) 
String tokenInCookie
  1. In /swagger-ui/index.html, only header parameter is defined in API, cookie is missing.

Screen Shot 2022-08-25 at 15 07 47

  1. In /v3/api-docs, there is only 1 parameter as well.

Screen Shot 2022-08-25 at 15 09 04

Expected behavior
From openapi-specification:

A unique parameter is defined by a combination of a name and location.

The access_token in header and cookie are in different location, but the cookie is missing.

Note: If changing parameter name to other value (e.g access_token1) for cookie, it shows well.
Screen Shot 2022-08-25 at 15 19 56

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants