我想为我正在构建的api拆分我的文档。我正在使用NelmioApiDocBundle,他们对视图注释有一种完美的方式。内尔米奥视图 问题是my方法保持在默认视图中,而不是在建议的oauth视图中:
因此/doc/api/oauth/或/api/doc/oauth以404结尾
//config.yml
# app/config/config.yml
nelmio_api_doc: ~
// app/config/routing.yml
NelmioApiDocBundle:
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
prefix: /api/doc
// routing.yml
profile_rest_oauth:
resource: "@ProfileBundle/Rest/Oauth/RestController.php"
type: rest
prefix: /api/oauth
profile_rest:
resource: "@ProfileBundle/Rest/Xwsse/RestController.php"
type: rest
prefix: /api
//RestController
use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Controller\Annotations;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Symfony\Component\HttpFoundation\Request;
class RestController extends FOSRestController
{
/**
* @ApiDoc(
* description="Update profile for user",
* section="profile",
* https=true,
* statusCodes={
* 200="OK, user profile updated",
* 400="Wrong input, no update"
* },
* views = { "oauth" }
* )
*/
public function putProfileAction(Request $request)
{
}
//composer.json
"nelmio/api-doc-bundle": "2.7.0",发布于 2017-05-25 21:33:27
要回答我自己的问题:版本"2.7.0“与至少需要2.9.0的视图参数不兼容。
发布于 2017-05-26 08:33:02
看上去不错。至少我可以说,如果设置正确- /api/doc/oauth永远不会给您404。
试着改变你的两个
resource: "@ProfileBundle/Rest/Xwsse/RestController.php"
to this like
resource: "@ProfileBundle/Resources/config/routing.yml"https://stackoverflow.com/questions/44162170
复制相似问题