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

How to use Security and SecurityRequirement #225

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

SOHELAHMED7
Copy link
Contributor

@SOHELAHMED7 SOHELAHMED7 commented Feb 5, 2025

Fixes #75


Current issues:

            'paths' => [
                '/test' => new PathItem([
                    'get' => new Operation([
                        'security' => [new SecurityRequirement(['BearerAuth' => []])],
                    ])
                ])
            ]

yields

'paths' => Array &1 (
        '/test' => Array &2 (
            'get' => Array &3 (
                'security' => Array &4 (
                    0 => Array &5 (
                        'BearerAuth' => Array &6 ()
                    )
                )
            )
        )
    )


            'paths' => [
                '/test' => new PathItem([
                    'get' => new Operation([
                        'security' => [new SecurityRequirement(['BearerAuth'])],
                    ])
                ])
            ]

yields

'paths' => Array &1 (
        '/test' => Array &2 (
            'get' => Array &3 (
                'security' => Array &4 (
                    0 => Array &5 (
                        0 => 'BearerAuth'
                    )
                )
            )
        )
    )


            'paths' => [
                '/test' => new PathItem([
                    'get' => new Operation([
                        'security' => [
                            'BearerAuth' => new SecurityRequirement([])
                        ],
                    ])
                ])
            ]

yields

'paths' => Array &1 (
        '/test' => Array &2 (
            'get' => Array &3 (
                'security' => Array &4 (
                    0 => Array &5 ()
                )
            )
        )
    )

This PR fixes above issues as

            'paths' => [
                '/test' => new PathItem([
                    'get' => new Operation([
                        'security' => new SecurityRequirements([
                            'BearerAuth' => new SecurityRequirement([])
                        ]),
                    ])
                ])
            ]

yields

'paths' => Array &1 (
        '/test' => Array &2 (
            'get' => Array &3 (
                'security' => Array &4 (
                    'BearerAuth' => Array &5 ( )
                )
            )
        )
    )

@SOHELAHMED7 SOHELAHMED7 marked this pull request as ready for review March 17, 2025 10:59
@SOHELAHMED7 SOHELAHMED7 changed the title Draft: How to use Security and SecurityRequirement How to use Security and SecurityRequirement Mar 17, 2025
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

Successfully merging this pull request may close these issues.

How to use Security and SecurityRequirement
1 participant