Skip to content

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

Open
@SOHELAHMED7

Description

@SOHELAHMED7

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://raw.githubusercontent.com/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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions