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

Unable to override rule for specific response path #2698

Open
KollarM opened this issue Sep 23, 2024 · 0 comments
Open

Unable to override rule for specific response path #2698

KollarM opened this issue Sep 23, 2024 · 0 comments

Comments

@KollarM
Copy link

KollarM commented Sep 23, 2024

For backward compatibility, I need to override the rule "must-always-return-json-objects-as-top-level-data-structures", but only for some operations.

Calling command yarn spectral lint .\swagger.json --ruleset ruleset.yaml gives error must-always-return-json-objects-as-top-level-data-structures for paths./v1/materials/bom.get.responses[200].content.application/json.schema

I tried to override this with many attempts in ruleset.yaml, but had no success.
extends:

  • ./zalando.yml
  • spectral:oas

#This section is for turning off rules
overrides:

  • files:
    • "swagger.json#/paths/1v11materials~1bom/get/responses[200]/content/application/json/schema"
    • "swagger.json#/paths/1v11materials~1bom/get/responses%5B200%5D/content/application/json/schema"
    • "swagger.json#/paths/1v11materials~1bom/get/responses[200]/content/application/json/schema"
    • "swagger.json#/paths/1v11materials~1bom/get/responses/[200]/content/application/json/schema"
    • "swagger.json#/paths/1v11materials~1bom/get/responses/%5B200%5D/content/application/json/schema"
    • "swagger.json#/paths/1v11materials~1bom/get/responses/[200]/content/application/json/schema"
    • "swagger.json#/paths/1v11materials~1bom/get/responses[200]..content..schema"
    • "swagger.json#/paths/1v11materials~1bom/get/responses%5B200%5D..content..schema"
    • "swagger.json#/paths/1v11materials~1bom/get/responses*/content/*/schema"
    • "swagger.json#/paths/1v11materials~1bom/get/responses[200]/content/*/schema"
    • "swagger.json#/paths/1v11materials~1bom/get/responses%5B200%5D/content/*/schema"
      rules:
      must-always-return-json-objects-as-top-level-data-structures: warn

~1 escapes /

%5B escapes [

swagger.json

%5D escapes ]

%7B escapes {

%7D escapes }

I'm attaching simplified swagger.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant