-
Notifications
You must be signed in to change notification settings - Fork 424
UI doesn't invoke URIs with optional path parameters #54
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
Comments
Hi sorry its taken a while to get back to you. Had a look at the Swagger spec and it looks like it only works with optional parameters for form and querystrings, but not path parameters. This is one of area where HAPI has wider functionality than Swagger. It would be possible to fix this, you would need to modify the swagger.js file function SwaggerOperation.prototype.urlify. I am trying not to make this type of change as it will make the plug-in harder to maintain. The swagger.js file is updated quite often. You could of course fork the project and do it yourself. If enough people want this, I will consider making the changes needed. |
Hi, +1 |
+1, would like to see this "fixed" |
+1 as well |
Hi Everyone Taken another look at this This use case of a optional path is not supported by swagger 1.2 spec and the current swagger UI code. swagger-api/swagger-ui#380 At the bottom of the comments on the issue Tony Tam says that the issue maybe fix with swagger 2.0 spec and new swagger UI. I am just about to start the work to move over to 2.0 swagger, so I hope there will be a fix for you somewhere down the line. I am not sure how long it going to take to rebuild the plug-in, but I will post on this issue again when I have something. |
Support for Swagger v2.x was added in December 2015 and we now have partial fixes for some of the path template issues The plug-in now supported for paths like:
There is no support for paths like
You still need to declare the path params in the routes
Sorry it took so long |
Glenn, I'll try to check it out in the next few days. I just wanted to say thank you now for all the work you've done on this plugin. It keeps on getting better and you apparently have endless energy. Great work! Jeff |
It looks like the Swagger UI has a problem with hapi-style optional path parameters. With a route defined as:
Swagger UI has no trouble at all. It documents the route, and enables me to invoke it from the UI. Great!
But when a parameterized path contains an optional parameter at the end, it has a problem:
Here it documents the route, including the optional parameter segment. But when I try to execute the from the UI, leaving the optional parameter blank, the UI never invokes the API.
Did I miss something in the documentation? Or is this an issue?
The text was updated successfully, but these errors were encountered: