Skip to content

How to use Security and SecurityRequirement - #225

Merged
cebe merged 27 commits into
cebe:masterfrom
SOHELAHMED7:how-to-use-security-and-securityrequirement-75
May 7, 2025
Merged

How to use Security and SecurityRequirement#225
cebe merged 27 commits into
cebe:masterfrom
SOHELAHMED7:how-to-use-security-and-securityrequirement-75

Conversation

@SOHELAHMED7

@SOHELAHMED7SOHELAHMED7 commented Feb 5, 2025

Copy link
Copy Markdown
Contributor

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
@SOHELAHMED7SOHELAHMED7 changed the title Draft: How to use Security and SecurityRequirementHow to use Security and SecurityRequirementMar 17, 2025
@cebecebe added this to the 1.8.0 milestone Apr 23, 2025
Comment threadsrc/spec/SecurityRequirement.php Outdated
@cebe
cebe merged commit e691d93 into cebe:masterMay 7, 2025
@cebe

cebe commented May 7, 2025

Copy link
Copy Markdown
Owner

Thank you!

Sign up for freeto 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

2 participants

@SOHELAHMED7@cebe