-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
Apply overrides to external files referenced from the root document #2195
Comments
I would vote for this feature too. We have a defined common types that will be used across different APIs and we would rather reference the common types using |
How can I vote for this more? :D |
I'd also like to vote for this. This is necessary for managing large APIs. |
Much needed because when you reference the - type: object
properties:
identifier:
type: string
description: |
Specifies the name of the parameter, whose value will be used as the identifier for a deployment.
schema:
$ref: 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.yaml#/definitions/Schema' You'll end up with errors like this:
And currently there's no way to tell spectral to ignore the external/imported schema. Or even, as described in the solution of the original poster, a way to customize the rules for a specific external schema. Renders spectral relatively useless for me right now. |
Any updates on this? This limitation is still an issue for us. The inability to define overrides on external schemas forces us to entirely turn off some rules that we would otherwise want to be on for the general case, thus limiting the value we're getting out of Spectral. |
May be spectral can merge all external ref into the current linting file ? Then it lint the whole but the most tricked part is for extensions. I like to use VS Code extension to directly lint my specification and it would be great to have the feature in the extension too. |
Is there any update regarding this feature? |
User story.
As a developer on a large API project, I can do apply rule overrides not just to the root document, but to external files as well, so that I can maintain the file structure that makes sense for my team.
Is your feature request related to a problem?
This is a feature request to effectively fix the caveat that was discovered in #2096 and currently documented at https://meta.stoplight.io/docs/spectral/e5b9616d6d50c-custom-rulesets#caveats:
This is a very odd an unexpected behavior. It's common to have things such as schema definitions in external files on large API spec projects, but looks like today there's no way to properly apply linter rule overrides to these files.
The only workaround is to keep your shared components in one large
my-document.yaml
file. This will work:But as I said, it's undesirable when describing a large API (e.g. a public API). Our team was refactoring a API spec project and were surprised to find out that we can no longer apply overrides to the same shared components we used to have, once we extracted them to external files.
Describe the solution you'd like
Given the setup described above (
my-document.yaml
with a root document,User.yaml
with a User model, and the corresponding"overrides"
block in .spectral.json), runningspectral lint my-document.yaml
should result in no errors:When Spectral resolves $refs, it should keep track of the original pointers and check if there are
overrides
defined for these locations.The text was updated successfully, but these errors were encountered: