How to tell Symfony 3 to ignore certain annotations?

前端 未结 2 740
耶瑟儿~
耶瑟儿~ 2021-01-18 03:37

I\'m developing an API with Symfony 3 and I want to use apidoc to create a documentation. Apidoc works with annotations:

/**
 * @api {get} /user/:id Request          


        
相关标签:
2条回答
  • 2021-01-18 04:01

    There is also a way to ignore an annotation globally. We didn't want to annotate each class, so we added this to our bootstrap file web/app.php.

    Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredName('your-custom-annotation');
    
    0 讨论(0)
  • 2021-01-18 04:11

    There's an @IgnoreAnnotation Doctrine annotation you can use. Try this:

    /**
     * @IgnoreAnnotation("api")
     * @IgnoreAnnotation("apiName")
     * @IgnoreAnnotation("apiGroup")
     * @IgnoreAnnotation("apiParam")
     * @IgnoreAnnotation("apiSuccess")
     */
    class SomeController extends Controller{
    ...
        /**
         * @api {get} /user/:id Request User information
         * @apiName GetUser
         * @apiGroup User
         *
         * @apiParam {Number} id Users unique ID.
         *
         * @apiSuccess {String} firstname Firstname of the User.
         * @apiSuccess {String} lastname  Lastname of the User.
         */
    

    The documentation is further down in that link.

    0 讨论(0)
提交回复
热议问题