2

I'm currently building a RESTful API using Symfony2.

In order to create a simple and clean documentation, I wish to use apidoc.js (I really would prefer to use this one, but if you have anything else to auto generate api documentation feel free to share).

This generator uses annotations which are parsed by Symfony kernel (apparently, from what I understand)

Here is my code for a controller

/**
 * @api {get} /contact/list Request Contacts List
 * @apiName List Contacts
 * @apiGroup Contacts
 *
 * @apiSuccess {Integer} Status
 * @apiSuccess {String} Custom Message to be displayed
 */
public function clientListAction(){}

Sadly, Symfony parses this, and throws me an error :

[Semantical Error] The annotation "@apiName" in method AppBundle\Controller\ClientApiController::clientListAction() was never imported.

Would you happen to have a solution to either prevent Symfony from parsing annotations (I'm always using YAML, so Symfony annotations are of no use to me actually), or just import those?

I'm quite new at this and I'm still struggling with creating a reliable and clean Symfony application.

Oldskool
  • 34,211
  • 7
  • 53
  • 66

2 Answers2

2

Use @ignoreAnnotation.

When using another library or program (e.g. Doxygen) that uses annotations, you should place the @IgnoreAnnotation annotation on the class to indicate which annotations Symfony should ignore.

Aerendir
  • 6,152
  • 9
  • 55
  • 108
0

Take a look at Nelmio Api Doc Bundle. It allows to generate documentation the similar way (by annotations).

Serge Kvashnin
  • 4,332
  • 4
  • 23
  • 37