Skip to content

Add support for empty Security Requirement Object ({}) in security requirement #238

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

Open
SOHELAHMED7 opened this issue May 12, 2025 · 0 comments · May be fixed by #239
Open

Add support for empty Security Requirement Object ({}) in security requirement #238

SOHELAHMED7 opened this issue May 12, 2025 · 0 comments · May be fixed by #239
Milestone

Comments

@SOHELAHMED7
Copy link
Contributor

SOHELAHMED7 commented May 12, 2025

From https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#security-requirement-object

An empty Security Requirement Object (`{}`) indicates anonymous access is supported.

This is used in https://github.com/raw/cloudflare/api-schemas/refs/heads/main/openapi.yaml L164315

Image

With current lib and above Cloudflare spec we get error:

There was 1 error:

1) IssueTest::test224FailsOnLargeDefinitions
Undefined offset: 0

/app/src/spec/SecurityRequirements.php:29
/app/src/SpecBaseObject.php:168
/app/src/SpecBaseObject.php:140
/app/src/SpecBaseObject.php:168
/app/src/SpecBaseObject.php:140
/app/src/spec/PathItem.php:81
/app/src/spec/Paths.php:62
/app/src/SpecBaseObject.php:168
/app/src/SpecBaseObject.php:140
/app/src/Reader.php:57
/app/src/Reader.php:138
/app/tests/IssueTest.php:17
phpvfscomposer:///app/vendor/phpunit/phpunit/phpunit:106

Observed this issue while fixing #224

So adding implementation for empty Security Requirement Object ({}) in security requirement is required.

More info about security schemes and security requirements can be obtained at https://swagger.io/docs/specification/v3_0/authentication/

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