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

Erroneous 'invalid-ref' reported when linting glob patterns and some schemas have a recursive ref #2562

Open
pwils33 opened this issue Dec 15, 2023 · 0 comments
Labels
enhancement New feature or request triaged

Comments

@pwils33
Copy link

pwils33 commented Dec 15, 2023

Created a simple repo that helps explain the bug can be found here

Describe the bug
Say you have the following structure

├── src
│   ├── folder-a
│   │   ├── schema-a.json
│   │   ├── schema-b.json
│   ├── folder-b
│   │   ├── schema-c.json
└── yourrules.spectral.yaml

If schema-b has a reference to schema-a and schema-a has a reference to schema-c and schema-c has a reference to itself, then if you were to run

spectral lint src/**/*.json

you would have an invalid-ref error reported for schema-b, but if you were to instead run

spectral lint src/folder-a/schema-b.json

no errors would be reported

To Reproduce

  1. Given file structure above, with references as described
  2. Run this CLI command spectral lint src/**/*.json
  3. See error

OR

  1. Clone https://github.com/cvent/spectral-bug-example
  2. Follow installation instructions
  3. run npm run lint
  4. See error

Expected behavior
No errors to be reported

Environment (remove any that are not applicable):
Spectral: 6.11.0

Additional context
See https://github.com/cvent/spectral-bug-example/blob/main/README.md for more details and thoughts on why bug is happening

@mnaumanali94 mnaumanali94 added the enhancement New feature or request label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triaged
Projects
None yet
Development

No branches or pull requests

2 participants