Swagger-UI: No support for duplicate path parameters. Sub resource locator issue.

380 views
Skip to first unread message

Andreas Arvidsson

unread,
Jun 7, 2016, 5:20:31 AM6/7/16
to Swagger
Hi!

I have a rest service which use multiple sub resources each with their own path param {id}. This gives problem with swagger-ui when testing the APi. It looks like swagger-ui can't handle multiple path parameters with the same name.

Ex of path:

This kind of path works fine using curl, accessing directly through the browser and such, but in swagger-ui if I enter 3 different IDs in the 3 input fields the last one will be used/inserted for all 3 parameters in the final url.

Sub resource locators (simplified) example:

@Path("/exercises")
@Api(value = "exercises")
public class Exercises {
   @Path("/{id}/instances")
   public Instances instances(@PathParam("id") long id) {
       return new Instances(id);
   }
}

@Path("/instances")
@Api(value = "instances")
public class Instances {
   @Path("/{id}/participants")
   public Participants participants(@PathParam("id") long id) {
       return new Participants(id);
   }
}

...


Ron Ratovsky

unread,
Jun 7, 2016, 2:21:08 PM6/7/16
to swagger-sw...@googlegroups.com

That’s not a legal swagger-spec. Each of the {id}’s would need to be different, as in, have a unique name.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages