Description
Q&A
- OS: [Ubuntu 24.04]
- Browser: [Firefox 139.0.1]
- Swagger-UI version: [4.15.5]
- Swagger/OpenAPI version: [ Swagger 2.2.20, OpenAPI 3.0.1]
Question
Hi everyone. Im working on a project based on JAXRS annotations. Im configuring a Swagger UI to sumarize all the endpoints of the project and to execute them from there. Im implementing OAS 3 which supports MatrixParams (URL MatrixParams) according to your specification.
However, after trying to execute methods which works with MatrixParams im realizing there's no possible to have MatrixParams in Swagger UI with JAXRS annotations.
Why? That's simple, JAXRS and Swagger UI supports MatrixParams in different ways.
Swagger UI needs to change the endpoint path to something like this:
@GET @Path("example/get{notifierType}")
@Produces(MediaType.APPLICATION_JSON)
String getNotifierType(@MatrixParam("notifierType") String notifierType)
throws CustomException;
Here is the big problem, if we change the method to follow Swagger UI specification, there's no manner to execute it from the Swagger UI because JAXRS interpretes that the endpoint now is
example/get{notifierType};notifierType=x. JAXRS interpetes {notifierType} like PathParam not like MatrixParam.
So the curl must be now:
curl -X 'GET' 'https://localhost:8080/xyz/config/example/self{notifierType};notifierType=email_local' -H 'accept: application/json'
But Swagger UI is generating this curl:
curl -X 'GET' 'https://localhost:8080/xyz/config/example/self;notifierType=email_local' -H 'accept: application/json'
So there's no manner to execute the endpoint from Swagger UI correctly.
Is there a way to change how Swagger UI interpetes MatrixParam according to JAXRS annotations?
Is it possible to execute method with MatrixParams in a JAXRS based project?