Skip to content

Overriding top-level security with a empty operation level security array #392

@nickeeex

Description

@nickeeex

The OAS specifies the operation level security object as follows:

A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#fixed-fields-8

The overriding with a empty array seems to be a problem when creating the OpenApiDocument from a Swagger 2.0 / OAS string as it gets deserialized into a empty list thus removing the information that the operation should override the security defined on the top level.

Example of operation level security that does not override the top-level one:
"security": []

Example that does override it but does not follow the spec
"security": [{}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions