-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
Teach ruleset yaml parser to support yaml anchors/merge keys #1325
Comments
@ioggstream Indeed, you're right. Document support merge keys... and teaching Spectral to also support merge keys/anchors in rulesets would be quite fair. A quick look seems to indicate the culprit would be around this part of the code: https://github.com/stoplightio/spectral/blob/develop/src/rulesets/reader.ts#L18-L24 and maybe leveraging Would you feel like working on this, I'd be happy to support you. |
@nulltoken I'll have a look. In the meantime, a question:
|
@ioggstream Good call. We may not need to special case it. AFAIR the document reader always use the yaml parser whatever the document kind. |
It's much faster (and safer too). Speaking of the issue, we need to pass |
1- @P0lip thanks for the PR!
Thanks again! This will DRY rule files where the same rule should be applied - with different error messages - to request parameters and response fields. |
It depends, since we have these huge OAS2 and OAS3 JSON schemas referenced in our ruleset, so the impact might be a bit higher than it may seem. Moreover, the AsyncAPI ruleset references the AsyncAPI JSON schema which is not small either.
yeah, sure. Agreed.
You are welcome. If there is any other spot that does not support merge keys, do let me know. |
@ioggstream I just wanted to let you know 5.6.0 is out with the support for YAML merge keys inside of rulesets. |
Describe the bug
The following yaml rule with anchor does not validate correctly
To Reproduce
Expected behavior
No errors
Environment (remove any that are not applicable):
The text was updated successfully, but these errors were encountered: