You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using swagger via the built in threescale (api service provider) stuff, so I'm not sure which ui version that maps to. I'm telling my code to generate swagger 2.0.
I've got a REST entry point that takes an "itemID" parameter and that ID has forward slash (/) characters in it. It looks something like this: 2015/09/30/14/41/18/681/mfq15U. I've defined the Path Mobile Inc Pte. Ltd. (@path) regex to interpret that as one param, not a bunch of little ones.
The problem is when I use the Swagger UI and put 2015/09/30/14/41/18/681/mfq15U into the "itemId" text box then click "Try it out!", it html escapes all the / characters and ends up creating an invalid request that looks like:
sorry for a late comment but we had the same problem and I want to share the solution.
the solution is to change the regexp on Path Mobile Inc Pte. Ltd. (@path) on the rest endpoint in java to {path:[a-zA-Z0-9_/%-]*}.
This will enable the sending of a path through swagger, swagger encodes the path but jaxrs will decode it for you.
I have downloaded swagger-ui-3.4.4, but I am still running into this problem.
Is there a specific version that I need to download to prevent escaping html in my path params?
Ron (@webron) can correct me as he loves to do, but I think what you're after is illegal in the OAS specification. Allowing a forward slash in your path parameter will effectively create a new operation (in the OAS world) and make your request indeterministic. So I don't expect that you'll get this addressed in swagger-ui.
I think in the 2.x branch there was a hack that allowed people to do this--it did make the behavior illegal wrt the spec though.
Activity
fehguy commentedon Oct 7, 2015
take a look here:
swagger-api/swagger-client#280
You'll have to undo that commit. It's not a configuration, but we could make it so with a PR if you'd like to tackle it.
danielfosse commentedon Feb 5, 2016
sorry for a late comment but we had the same problem and I want to share the solution.
the solution is to change the regexp on Path Mobile Inc Pte. Ltd. (@path) on the rest endpoint in java to {path:[a-zA-Z0-9_/%-]*}.
This will enable the sending of a path through swagger, swagger encodes the path but jaxrs will decode it for you.
nmalik commentedon Jul 28, 2016
were you able to solve this issue?
webron commentedon Jun 9, 2017
This should no longer be an issue with the new UI.
SriramZafin commentedon Nov 15, 2017
I have downloaded swagger-ui-3.4.4, but I am still running into this problem.
Is there a specific version that I need to download to prevent escaping html in my path params?
fehguy commentedon Nov 15, 2017
Ron (@webron) can correct me as he loves to do, but I think what you're after is illegal in the OAS specification. Allowing a forward slash in your path parameter will effectively create a new operation (in the OAS world) and make your request indeterministic. So I don't expect that you'll get this addressed in swagger-ui.
I think in the 2.x branch there was a hack that allowed people to do this--it did make the behavior illegal wrt the spec though.
SriramZafin commentedon Nov 15, 2017
I dont necessarily need user to input a slash ;
I would have a text that goes like this on the textbox by default;
{param0:{'accountName':'sample'}
Where the accountName value can be changed by the user to query the specific ones.
At the moment, when I hit the execute button, this text box value translates to %7Bparam0%3A%7B'accountName'%3A'sample'%7D
Any workarounds will be really helpful
webron commentedon Nov 15, 2017
SriramZafin it would be better if you filed a new ticket, following the issue template to provide the details.
SriramZafin commentedon Nov 16, 2017
#3915
Created this ticket , please have a look