Skip to content

Path parameters can't be empty. #182

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

Closed
Timmmm opened this issue Apr 8, 2013 · 4 comments
Closed

Path parameters can't be empty. #182

Timmmm opened this issue Apr 8, 2013 · 4 comments

Comments

@Timmmm
Copy link

Timmmm commented Apr 8, 2013

If you have a parameter with type path that you leave blank, swagger-ui won't let you submit the request even if the parameter is optional.

For example I have a URI like this: http://foo.com/search/{query} and I might want search for everything using a blank query like this: http://foo.com/search/ but currently swagger won't let me submit that request (clicking the "Try it out!" button does nothing).

@fehguy
Copy link
Contributor

fehguy commented Apr 8, 2013

with swagger, path params are always required, or it changes the overall route syntax. I think that would be quite difficult to change

@Timmmm
Copy link
Author

Timmmm commented Apr 8, 2013

I don't follow, isn't it just a textual search & replace?

@fehguy
Copy link
Contributor

fehguy commented Apr 8, 2013

You can certainly hack around in the swagger-ui, but in general, swagger wants path parameters to be required. For instance:

/foo/{bar}/search
/foo/search

If {bar} is omitted, the container would receive /foo//search which is interpreted as /foo/search in many server frameworks. To avoid the pitfalls of that, swagger says path parameters are required.

@fehguy
Copy link
Contributor

fehguy commented May 2, 2014

Hi, this is a duplicate of #380

Closing this one as there's more information in #380.

@fehguy fehguy closed this as completed May 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants