1

我正在使用这个。我想在我的网址中有一个可选参数

例如我有这条路线

$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 和这个插件,我可以用我的文档做 CURL。如果我选择所有值为 0 我的卷曲就像

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

我想要一个像

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

1 回答 1

0

最近重写了 swagger ui (with version v3.0.0),因为您的代码按预期工作。所以这可能是chrome扩展使用的版本中的一个bug v2.2.8

由于 swagger ui 只有 html 和 js,您可以简单地下载最新版本的 swagger-ui并使用这个而不是扩展名。

于 2017-04-20T15:53:56.823 回答