我想将 nelmio 用于 symfony-project,但它不起作用。
它总是说:规范中没有定义任何操作!
我还尝试了https://symfony.com/doc/current/bundles/NelmioApiDocBundle/index.html上的示例
怎么了?有任何想法吗?
路由.yml
app.swagger_ui:
path: /api/doc
methods: GET
defaults: { _controller: nelmio_api_doc.controller.swagger_ui }
配置.yml
nelmio_api_doc:
areas:
path_patterns: # an array of regexps
- ^/api(?!/doc$)
host_patterns:
- ^api\.
控制器
/**
* @Route("/api/test", methods={"GET"})
* @SWG\Response(
* response=200,
* description="Returns the rewards of an user"
* )
* @SWG\Parameter(
* name="order",
* in="query",
* type="string",
* description="The field used to order rewards"
* )
*/
public function testAction()
{
}
作曲家.json
"symfony/symfony": "3.4.*",
"nelmio/api-doc-bundle": "3.2.1",