Description
Describe the bug
Not distinction between different parameter conditions on the same path in swagger json.
To Reproduce
Simple example project
https://github.com/Jelicho/springdoc-openapi-parameter-condition-example
As in the example below, two separate APIs are provided with different parameter conditions on the same path.
The response format is also different. However, in swagger json and ui, they are configured and exposed as one.
- path :
/api/example/{exampleNo}
- parameter condition :
application=service1
,application=service2
- Response :
ExampleDataForService1Dto
,ExampleDataForService2Dto
@Operation(
operationId = "exampleForService1",
description = "Returns Example data for service1 application."
)
@GetMapping(value = "/{exampleNo}", params = "application=service1")
public ExampleDataForService1Dto exampleForService1(
@PathVariable String exampleNo
) {
return ExampleDataForService1Dto.builder()
.exampleNo(exampleNo)
.exampleName("exampleName")
.build();
}
@Operation(
operationId = "exampleForService2",
description = "Returns Example data for service2 application."
)
@GetMapping(value = "/{exampleNo}", params = "application=service2")
public ExampleDataForService2Dto exampleForService2(
@PathVariable String exampleNo
) {
return ExampleDataForService2Dto.builder()
.exampleNo(exampleNo)
.exampleAddress("exampleAddress")
.build();
}

swagger json
// http://localhost:8080/v3/api-docs
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "http://localhost:8080",
"description": "Generated server url"
}
],
"paths": {
"/api/example/{exampleNo}": {
"get": {
"tags": [
"Example"
],
"description": "Returns Example data for service1 application.",
"operationId": "exampleForService1_1",
"parameters": [
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ExampleDataForService2Dto"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ExampleDataForService2Dto": {
"type": "object",
"properties": {
"exampleNo": {
"type": "string"
},
"exampleAddress": {
"type": "string"
}
}
}
}
}
}
Expected behavior
The results of my custom configuration are as follows.
I would like it to be exposed separately according to parameter conditions as shown below.

swagger json
// http://localhost:8080/v3/api-docs
{
"openapi": "3.0.1",
"info": {
"title": "example API",
"version": "1.0"
},
"servers": [
{
"url": "http://localhost:8080",
"description": "Generated server url"
}
],
"paths": {
"/api/example/{exampleNo}?application=service2": {
"get": {
"tags": [
"Example"
],
"description": "Returns Example data for service2 application.",
"operationId": "exampleForService2",
"parameters": [
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ExampleDataForService2Dto"
}
}
}
}
}
}
},
"/api/example/{exampleNo}?application=service1": {
"get": {
"tags": [
"Example"
],
"description": "Returns Example data for service1 application.",
"operationId": "exampleForService1",
"parameters": [
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ExampleDataForService1Dto"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ExampleDataForService2Dto": {
"type": "object",
"properties": {
"exampleNo": {
"type": "string"
},
"exampleAddress": {
"type": "string"
}
}
},
"ExampleDataForService1Dto": {
"type": "object",
"properties": {
"exampleNo": {
"type": "string"
},
"exampleName": {
"type": "string"
}
}
}
}
}
}
Additional context
Even if it is not supported by default, it would be nice if an option was provided that allows it to be exposed separately according to parameter conditions through on/off.