Redocly / redocly-vs-code

Redocly VS Code extension
35 stars 6 forks source link

Should not complain about missing server if you yaml contains only components #57

Closed cvgaviao closed 8 months ago

cvgaviao commented 9 months ago

What happened? I'm getting an error mark in an yaml containing only components

What should have happened instead? The missing server rule must be applied only when paths (or webhook?) are present.

Also, I'm getting never used warnings for all schemas in this case.

Minimal reproducible OpenAPI snippet

openapi: 3.1.0
info: 
  title: Common Schemas
  version: "latest"

components: 
  schemas: 
    BusinessUnit:
      title: BusinessUnit
      type: object
      properties:
        id:
          type: integer
          format: int32
        description:
          type: string

If possible, include a short example of your OpenAPI definition that we can use to simulate the problem.

Screenshots image

Additional context

Release 0.3.3 (2023-11-16)

lornajane commented 9 months ago

I think this is related to (if not exactly a duplicate) #51

tatomyr commented 9 months ago

This is not an extension issue. The behaviour of the Redocly CLI linter will be the same. Could you provide a link to the specification to clarify the correct behaviour?

Also, I'm getting never used warnings for all schemas in this case.

They are unused indeed 🙂. You can turn off warnings or make any other adjustments to rules using Redocly config: https://redocly.com/docs/cli/configuration/rules/#configure-your-linting-rules

adamaltman commented 8 months ago

I don't think this is a bug.

Our default rules are (mildly) opinionated, and if you don't supply a redocly.yaml to turn off the server or unused components rules you will see errors or warnings.

You can control with a configuration file.

Please re-open if you think I'm incorrectly closing this as "not a bug"...