2017-04-20 149 views
1

我正在使用此library。我想在我的网址的可选参数Swagger注释中可选的路径参数

比如我有这条路线

$app->get('/files/{order:\d+}[/{all:0|1|all}]', 'myctroller'); 

我的注释是

/** 
* @SWG\Get(path="/doc/v1/files/{id_ordine}/{all}", 
* tags={"GETFILE"}, 
* produces={"application/json"}, 
* @SWG\Parameter(
*  name="order", 
*  in="path", 
*  type="integer", 
*  required=true, 
*  default="123", 
* ), 
* @SWG\Parameter(
*  name="all", 
*  in="path", 
*  type="string", 
*  enum={"0","1","all"}, 
*  default="all", 
*  required=false, 
* ), 
* @SWG\Response(response="200", description=xxx"), 
* @SWG\Response(response="404", xxx") 
*) 
*/ 

随着Chrome和与this plugin我可以用我的文档做卷曲。 如果我选择用0值我所有的卷发像

http://localhost/doc/v1/files/123/{all} 

我想有一个像

http://localhost/doc/v1/files/123 

回答

0

卷曲最近有招摇UI(与v3.0.0版)的改写,在您的代码按预期工作。 所以这可能是Chrome扩展使用v2.2.8版本中的一个错误。

由于swagger ui只是html和js,因此您可以简单地使用download a recent version of the swagger-ui并使用此扩展名代替扩展名。