Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Do not default to an empty list if a property is missing in the OpenAPI description #1797

Copy link
Copy link
@calebkiage

Description

@calebkiage
Issue body actions

Describe the bug
According to the Operation Object description, The security property should be treated differently depending on whether it was missing or explicitly set to an empty array. If it was an empty array, it should clear the root level security property declaration. If it wasn't provided, the root level declaration applies to the operation.

OpenApi File To Reproduce

openapi: 3.0.0
info:
  title: test
  version: "1.0"
paths:
  /test:
    get:
      description: description for test path
      responses:
        '200':
          description: test
      security: [] #<---- this operation should not use any security. if we remove this, the operation will use the root level security declaration
security:
- apiKey0: [] #<---- root level security declaration
components:
  securitySchemes:
    apiKey0:
      type: apiKey,
      name: x-api-key,
      in: header

Expected behavior

If the security property is not provided, the value in the library should be null to allow differentiating between missing and empty properties. Another alternative is to allow checking if a property was provided in the document.

Screenshots/Code Snippets

N/A

Additional context

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

type:bugA broken experienceA broken experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.