Closed
Description
Describe the bug
If a controller has an endpoint that can be called with different possible headers (key + value), then in the doc generated, in the parameters, the possible values for the headers appear twice.
How to reproduce
(Using Java 11, SpringBoot 2.7.2, springdoc-openapi-webmvc-core 1.6.10 based on Swagger-core 2.2.2)
git clone https://github.com/didjoman/springdoc-double-headers-issue
Run the application (spring boot).
Run curl --location --request GET 'http://localhost:8080/doc' --header 'Content-Type: application/json'
Expected behavior
We should obtain a schema like this, without duplication of the enum values of the parameters.
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "http://localh",
"description": "Generated server url"
}
],
"paths": {
"/": {
"get": {
"tags": [
"basic-controller"
],
"operationId": "get1_1_1",
"parameters": [
{
"name": "foo",
"in": "header",
"schema": {
"type": "string",
"enum": [
"bar"
]
}
},
{
"name": "fi",
"in": "header",
"schema": {
"type": "string",
"enum": [
"ri"
]
}
},
{
"name": "User-Agent",
"in": "header",
"schema": {
"type": "string",
"enum": [
"MyUserAgent"
]
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
},
"components": {}
}
Actual behavior
Today, the possible values of the headers other than the first one get duplicated.
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "http://localh",
"description": "Generated server url"
}
],
"paths": {
"/": {
"get": {
"tags": [
"basic-controller"
],
"operationId": "get1_1_1",
"parameters": [
{
"name": "foo",
"in": "header",
"schema": {
"type": "string",
"enum": [
"bar"
]
}
},
{
"name": "fi",
"in": "header",
"schema": {
"type": "string",
"enum": [
"ri",
"ri"
]
}
},
{
"name": "User-Agent",
"in": "header",
"schema": {
"type": "string",
"enum": [
"MyUserAgent",
"MyUserAgent"
]
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
},
"components": {}
}
Additional context
/
Metadata
Metadata
Assignees
Labels
No labels