-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
Paths are not reported correctly after multiple recursions of resolution #2043
Comments
@hudlow I was just about to open the same exact issue, I just add that the expected behavior should be to report a single error pointing to |
@albertored Yes, in the end, that's right. What was supposed to be implicit in the expected behavior I noted above was that if duplicates are created with the same path, Spectral's deduplication logic should clean them up. 😄 |
@P0lip Any update on this issue? I'm seeing not just redundant validations but completely incorrect paths printed that seem to be caused by the underlying issue here. |
🎉 This issue has been resolved in version @stoplight/spectral-cli-v6.4.2 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version @stoplight/spectral-core-v1.12.4 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
Describe the bug
It appears that the path of an error is reported correctly if resolve goes through a single
$ref
resolution, but not if it goes through more than one.To Reproduce
Given this set of schemas:
Example grandparent, parent, and child schemas
...only the
Child
schema violates this rule:...but Spectral reports a violation in redundant locations:
This doesn't happen if the
Grandparent
schema doesn't exist, so it seems to be an artifact of Spectral looking "through" theGrandparent
schema. The result makes sense to me in that ifcomponents.schemas.Parent.properties.child
is "resolved" then it's the location of a second error.But things get even stranger if I add a
GreatGrandparent
:Example schemas with great grandparent
Now the same Spectral rule reports three errors:
The error at
components.schemas.Grandparent.properties.child
seems to exist because of the presence of theGreatGrandparent
schema, but it doesn't really make sense to me at all, because even if one fully "resolved" the schema, there wouldn't be an error at that location. Rather, there would be one at "components.schemas.Grandparent.properties.child.properties.child
", I think.In any case, it seems like Spectral isn't able to keep track of the "real" path of an error as it recurses through a resolved document.
Expected behavior
Any number of errors caused by the same problem in the same place should report the same path.
Environment (remove any that are not applicable):
spectral --version
reports6.2.0
The text was updated successfully, but these errors were encountered: