I would like to create OpenAPI UI spec, using Spring WebFlux functional router on Kotlin. Spring Boot v.2.5.2, springdoc-openapi v.1.5.9. Here is my router class:
@Configuration
class UserServiceRouter {
@Bean
@RouterOperations(
RouterOperation(
path = "/user/{id}",
method = [RequestMethod.GET],
beanClass = UserService::class,
beanMethod = "getUserCredentialsById",
operation = Operation(
parameters = [Parameter(
style = ParameterStyle.SIMPLE,
explode = Explode.FALSE,
`in` = ParameterIn.PATH
)]
)
),
RouterOperation(
path = "/user/profile/{id}",
method = [RequestMethod.GET],
beanClass = UserService::class,
beanMethod = "getUserProfileById",
operation = Operation(
parameters = [Parameter(
style = ParameterStyle.SIMPLE,
explode = Explode.FALSE,
`in` = ParameterIn.PATH
)]
)
)
fun userRoute(userServiceHandler: UserServiceHandler) = coRouter {
("/user").nest {
GET("/{id}", userServiceHandler::getUserCredentialsById)
GET("/profile/{id}", userServiceHandler::getUserById)
}
}
}
I want to create a GET query like
http://localhost:8080/user/1
where 1 is my desired user`s ID.
But my OpenAPI`s UI still tries to create query with GET parameter
http://localhost:8080/user/{id}?id=1
which obviously leads to error 400. Would be nice to know how my @RouterOperations should be configured appropriately.