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

Empty scopes for a security definition ends up being an empty array. It should be an empty object. #555

Open
MeesterDev opened this issue Aug 16, 2023 · 0 comments

Comments

@MeesterDev
Copy link

  • L5-Swagger Version: 8.5.1
  • PHP Version: 8.1.17
  • OS: Ubuntu (WSL 1)

Description:
Empty scopes for a security definition ends up being an empty array. It should be an empty object.

Steps To Reproduce:

Use the following security definitions:

        'securityDefinitions' => [
            'securitySchemes' => [
                'oauth2' => [
                    'type' => 'oauth2',
                    'description' => 'OAuth2 login',
                    'flows' => [
                        'password' => [
                            'tokenUrl' => '/some/token/url',
                            'refreshUrl' => '/some/refresh/url',
                            'scopes' => [],
                        ],
                    ],
                ],
            ],
            'security' => [
                'oauth2' => [],
            ],
        ],

Generate the documentation.

You'll end up with

        "securitySchemes": {
            "oauth2": {
                "type": "oauth2",
                "description": "OAuth2 login",
                "flows": {
                    "password": {
                        "tokenUrl": "/some/token/url",
                        "refreshUrl": "/some/refresh/url",
                        "scopes": []
                    }
                }
            }
        }

Note the "scopes": []? That should be "scopes": {}. See: https://swagger.io/docs/specification/authentication/oauth2/#no-scopes.

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

No branches or pull requests

1 participant