nelmio / NelmioApiDocBundle

Generates documentation for your REST API from annotations
MIT License
2.22k stars 833 forks source link

More Advanced Area Filtering Based on `@Areas` Annotations and Config #1425

Open ThomasLabstep opened 5 years ago

ThomasLabstep commented 5 years ago

Hi!

The documentation is unclear, but I see this in the source code:

/**
 * @internal
 */
final class TagDescribersPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        foreach ($container->findTaggedServiceIds('nelmio_api_doc.describer') as $id => $tags) {
            $describer = $container->getDefinition($id);
            foreach ($container->getParameter('nelmio_api_doc.areas') as $area) {
                foreach ($tags as $tag) {
                    $describer->addTag(sprintf('nelmio_api_doc.describer.%s', $area), $tag);
                }
            }
        }
    }
}

I want to make different api documentation url display a tagged list of endpoint (that share the exact same path, all my endpoints are /api or /public-api, but I want to filter them out into 3 tags).

Any idea?

Thanks!

GuilhemN commented 5 years ago

I think what you're looking for is https://github.com/nelmio/NelmioApiDocBundle/pull/1460, right?

chrisguitarguy commented 2 years ago

So general gist: we have this with_annotation thing that allows restricting an area to those routes tagged with @Areas, but this is probably more along the lines of "include routes tagged with area1, area2, and area3.