0
votes

I want to split up my documentation for the api I am building. I am using NelmioApiDocBundle and they have a perfect way with the view annotation. Nelmio view The problem is my method stays in default view and not in the suggested oauth view:

So /doc/api/oauth/ or /api/doc/oauth ends in 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",
2
have you remembered the use statement for ApiDoc in your controller?DevDonkey
@DevDonkey Thanks for the respond, but yes I used the bundle. I updated my postVince Verhoeven

2 Answers

0
votes

To answer my own question: the version "2.7.0" in not compatible with the view parameter you need atleast 2.9.0". It's hard to understand it from the symfony documentation because it show version 2.x symfony documentation

0
votes

Looks good man. At least i can say if you set up everything right - the /api/doc/oauth should never give you 404.

Try to change both your

resource: "@ProfileBundle/Rest/Xwsse/RestController.php"
to this like
resource: "@ProfileBundle/Resources/config/routing.yml"