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

Spectral oas3-unused-component warning #2571

Open
igorkud90 opened this issue Jan 10, 2024 · 0 comments
Open

Spectral oas3-unused-component warning #2571

igorkud90 opened this issue Jan 10, 2024 · 0 comments
Labels
OpenAPI Issues related to the OpenAPI ruleset p/medium t/bug Something isn't working

Comments

@igorkud90
Copy link

Describe the bug
Spectral alert oas3-unused-component warning.

To Reproduce

  1. Given this OpenAPI document and referenced document in same folder:

index.yaml

openapi: 3.1.0
info:
  title: Test
  version: 1.0.0
paths:
  '/':
    description: test
    get:
      operationId: test
      description: test
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: './common.yaml#/components/schemas/ResponseType'

common.yaml

openapi: 3.1.0
info:
  title: Common schema definition
  description: test
  version: 1.0.0
paths: {}
components:
  schemas:
    # Spectral lint warning "Potentially unused component has been detected."
    ResponseType:
      type: string
      example: test
      description: test
  1. Run this CLI command
spectral lint index.yaml common.yaml
  1. See warning
/tmp/test/common.yaml
 10:18  warning  oas3-unused-component        Potentially unused component has been detected.  components.schemas.ResponseType

Expected behavior
Component ResponseType used in index.yaml. Spectral can't alert oas3-unused-component warning.

@mnaumanali94 mnaumanali94 added t/bug Something isn't working OpenAPI Issues related to the OpenAPI ruleset p/medium labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenAPI Issues related to the OpenAPI ruleset p/medium t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants