我正在使用Symfony框架,並且有意圖將自動文檔引擎添加到我的項目的RESTful api中。Symfony - 註釋從未導入
經過一番搜索,我找到了apidoc引擎(http://apidocjs.com/)。它的工作原理非常簡單:您必須爲您的每個控制器添加一些註釋RESTful API和文檔將生成。
註釋的例子是:
/**
* @Route("/api/dictionary_list/{userId}/{sessionKey}", name="api/dictionary_list")
* @api {get} /api/dictionary_list/{userId}/{sessionKey} 01. Values list (ids) for all system dictionaries
* @apiName Dictionary list
* @apiGroup Dictionary
*
* @apiParam {Integer} userId User's ID received in authorization request
* @apiParam {String} sessionKey Session key received in authorization request
*
* @apiSuccess {Integer} parcelStatuses The name of current dictionary
* @apiSuccess {String} itemId Item id which used in requests
* @apiSuccess {String} itemName Item name
*/
public function dictionaryListAction($userId=null, $sessionKey=null)
{
...
}
正如你可以看到,標註爲apidoc是一樣的註釋中的Symfony路由。
通過在生產環境中正常工作的方式,但在開發環境中我得到這樣
[Semantical Error] The annotation "@apiName" in method AppBundle\Controller\Api\apiDictionaryController::dictionaryListAction() was never imported.
例外有沒有什麼辦法來解決這個問題,並告訴Symfony的該批註的apidoc已被忽略?
討論[這裏](https://github.com/symfony/symfony/issues/17000)也 – Matteo