Swagger-PHP, without annotation with Symfony2 and NelmioApiDocBundle

Is it possible to create documentation for a RESTful API without annotations, but, say, in a configuration file?

something like that:

[<route name>|MyBundle\Bundle\User]:
    "@ApiDoc(
        statusCodes={
        200="Returned when successful",
        403="Returned when the user is not authorized to say hello",
        404={
            "Returned when the user is not found",
            "Returned when something else is not found"
        }
     }
    )"
...

I need this because our current API inherits the CRUD behavior from the superclass, instead of having a child method for each request.

So, instead of having a bunch of ugly methods like this:

...

public function readAction()
{
    parent::readAction();
}
...

I would prefer, if possible, a patch to simulate annotation behavior and automatically generate annotation configuration file.

Has anyone done something like this?

Thank.

+4
source share

Source: https://habr.com/ru/post/1545284/


All Articles