我想爲我正在構建的api分割我的文檔。我正在使用NelmioApiDocBundle,並且它們具有視圖註釋的完美方式。 Nelmio view問題是我的方法停留在默認視圖,而不是在建議OAuth的看法:Symfony2:爲什麼NelmioApiDocBundle中的視圖註釋不起作用?
所以/ 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",
你記得在你的控制器'ApiDoc'使用的語句? – DevDonkey
@DevDonkey感謝您的迴應,但是我使用了捆綁包。我更新了我的帖子 –