-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swagger UI generates wrong request #335
Comments
Hi, the path parameters (in your case,
That said, it's discouraged to do this in the path param with swagger, and the tooling currently doesn't support it. |
I have the same issue with any path parameter, it's not the regex. |
This can really only be caused by a mismatch between the path segment {id} and the path parameter name. Can you confirm they match? |
the path parameter in the @path matches to the one in the @PathParam if that's what you meant: |
Also posted in the Swagger Google group.
In Swagger UI, I'm trying the interactive "try it" on a GET resource by ID. I insert an ID - an integer, and when I press on the "try it" button I see that
the generated request is wrong, instead of inserting the id I from the input field and build the request with the ID part of the URL, the request renders the path parameter as the regex string I have in the @path annotation:
for example:
I have the code:
@get
@path("/applications/{id:[0-9]+}")
@produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
ApplicationDTO getApplicationById(ApiParam(name = "Application ID", value = "The ID of the application", required = true) @PathParam("id") long applicationId){...}
in the input field I'm inserting ID = 1, so I expect the following request:
http://localhost/applications/1
instead, the "try it" button generates:
http://localhost/applications/%7Bid:%5B0-9%5D+%7D
which is the encoded URL of:
http://localhost/applications/{id:[0-9]+}
it's worth mentioning that for a @QueryParam the request generates fine:
if the code is like
@get
@path("/applications/")
@produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
ApplicationListDTO getApplications(ApiParam(name = "Application name", value = "name of the application or part of name of application") @QueryParam("name") String name){...}
and in the input field I'm inserting name = "app", the "try it" button generates the expected URL: http://localhost/applications?name=app
Any help getting the path parameters in the request ? Does Swagger supports that ?
The text was updated successfully, but these errors were encountered: