Skip to content
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

no-security-schemes-defined erroneously matches non-root components object #2771

Open
robincgit opened this issue Jan 24, 2025 · 0 comments
Open
Assignees
Labels
t/bug Something isn't working

Comments

@robincgit
Copy link

Describe the bug

The no-security-schemes-defined rule seems to incorrectly match non-root components objects, resulting in false positives.

To Reproduce

Given this openapi.yml document:

openapi: '3.1.0'
info:
  title: TITLE
  version: 'VERSION'

paths: {}

components:
  schemas:
    Foo:
      type: object
      properties:
        components:
          type: number

  securitySchemes:
    sec:
      type: http
      scheme: bearer

Run this CLI command:

$ spectral lint openapi.yml
[...]
 13:20    error  no-security-schemes-defined  All APIs MUST have a security scheme defined.             components.schemas.Foo.properties.components

Expected behavior

The rule should not match, i.e the behavior should be the same as when renaming the components property of the above Foo schema to component.

Environment

  • Library version: 6.14.2
@mnaumanali94 mnaumanali94 added the t/bug Something isn't working label Feb 4, 2025
@mnaumanali94 mnaumanali94 self-assigned this Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants