micronaut openapi/swagger component cannot handle @Version
Expected Behavior
I created two endpoints, and enabled OpenAPI and swagger UI.
@ApiResponses(
value = [
ApiResponse(
responseCode = "200", description = "v1",
content = [
(
Content(
mediaType = "plain/text"
)
)
]
),
ApiResponse(responseCode = "500", description = "Internal Server Error"),
]
)
@Version("1")
@Get("/hello")
fun helloV1(req: String): String {
return "HelloV1"
}
@ApiResponses(
value = [
ApiResponse(
responseCode = "200", description = "v2",
content = [
(
Content(
mediaType = "application/json",
array = (ArraySchema(schema = Schema(implementation = Map::class)))
)
)
]
),
ApiResponse(responseCode = "500", description = "Internal Server Error"),
]
)
@Version("2")
@Get("hello")
fun helloV2(req: Map): Map {
return req;
}
I hope to see two endpoints or one endpoint but different header X-API-VERSION values should go with different request structure and response payload
Actual Behaviour
Only one endpoint /hello with request parameter and response descriptions of @Version("1")
Steps To Reproduce
No response
Environment Information
No response
Example Application
No response
Version
3.4.2
@hittlle Hi! I'm sorry, but I didn't understand what you are trying to do with your example. Not sure if this code can work, most likely you will get an error: More than 1 route matched the incoming request. The following routes matched /hello: GET - /hello, GET - /hello . To understand what the problem is, please create a full-fledged example that reproduces the problem
Fixed in micronaut-openapi 4.10.0