【发布时间】:2015-12-02 12:16:36
【问题描述】:
TLDR:使用 Swagger 的多个路径参数和端点
我想要的是一些这样的 API 端点:
/foo/{id}/bar
现在 afaik foo 或路径中的第一个节点正在定义端点以及 aqcuire 的资源。因此会生成一个 FooApiServiceImpl。
生成的 ProjectsApiService 存根类似于 atm:
@GET
@Path("/{id}/bars")
...
public Response getBarsByFooId(@ApiParam(value = "The id of the foo with the bars",required=true ) @PathParam("id") String id)
throws NotFoundException {
return delegate.getBarByFooId(id);
}
现在我希望的行为是使用给定的{id} 获取连接到Foo 的所有Bar 资源。有点像倒序。这有可能吗?
如果这是不可能的......那么还想问一下,我怎样才能获得未定义为{xxx}括号中的参数的url节点(foo,bar)?
类似这样的:
public Response getBarsByFooId(String foo, String id, String bar)
throws NotFoundException {
return delegate.getBarByFooId(id);
}
【问题讨论】:
标签: web-services rest jax-rs swagger