Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: tags within api definition are not unique #2308

Closed
maglnet opened this issue Jul 3, 2024 · 1 comment
Closed

[Bug]: tags within api definition are not unique #2308

maglnet opened this issue Jul 3, 2024 · 1 comment
Labels

Comments

@maglnet
Copy link

maglnet commented Jul 3, 2024

Version

v4.26.2

Description

Hi,

when having the same tag for multiple methods / routes the resulting api definition has the same tag multiple times but the specification says that tag names must be unique.

Within the specification for the tags within the OpenAPI object, the OpenAPI specification says:

Each tag name in the list MUST be unique.

Perhaps I'm doing something wrong?

Example class:

use OpenApi\Attributes as OA;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;

class ExampleController extends AbstractController
{

    /**
     * example method foo
     *
     * @return JsonResponse
     */
    #[Route('/foo')]
    #[OA\Tag('Example')]
    public function exampleFoo(): Response
    {
        new JsonResponse(['foo']);
    }

    /**
     * example method bar
     *
     * @return JsonResponse
     */
    #[Route('/bar')]
    #[OA\Tag('Example')]
    public function exampleBar(): Response
    {
        new JsonResponse(['bar']);
    }
}

this results in a tag list like this:

{
    "tags": [
        {
            "name": "Example",
            "description": "Example"
        },
        {
            "name": "Example",
            "description": "Example"
        }
    ]
}

but imho it should result in a tags list like this:

{
    "tags": [
        {
            "name": "Example",
            "description": "Example"
        }
    ]
}

Best regards,
Matthias

Additional context

No response

@maglnet maglnet added the bug label Jul 3, 2024
@DjordyKoert
Copy link
Collaborator

This looks like an issue for https://github.com/zircote/swagger-php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants