NelmioApiDocBundle icon indicating copy to clipboard operation
NelmioApiDocBundle copied to clipboard

Using disable_default_routes filters out routes using attributes

Open JohnstonCode opened this issue 1 year ago • 1 comments

Given this config

nelmio_api_doc:
  areas:
    disable_default_routes: true

And this controller

<?php

namespace App\Action;

use OpenApi\Attributes as OA;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;

class TestAction
{
    #[Route('/api/test', methods: ['POST'])]
    #[OA\Post(
        operationId: 'test',
        summary: 'Test endpoint',
        tags: ['Test'],
        responses: [
            new OA\Response(response: 201, description: 'test'),
            new OA\Response(response: 400, description: 'Bad request')
        ],
    )]
    public function __invoke() : JsonResponse
    {
        return new JsonResponse(['success']);
    }
}

No docs are generated. image

JohnstonCode avatar Jul 18 '22 13:07 JohnstonCode

The provided PR resolves this issue image

JohnstonCode avatar Jul 18 '22 13:07 JohnstonCode