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
fix(rulesets): handle empty payload and headers in AsyncAPI message's examples validation #2284
fix(rulesets): handle empty payload and headers in AsyncAPI message's examples validation #2284
Conversation
29d2c52
to
a7f9fa7
Compare
… examples validation
c180dc3
to
dd647d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one comment in terms of traits, as this makes it easier for developers that stumble upon the code to follow it.
Otherwise it looks good 👍
|
||
type HaveTraits = { traits?: any[] } & Record<string, any>; | ||
|
||
export function mergeTraits<T extends HaveTraits>(data: T): T { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably add some more docs here and specifically stating that this is JSON Merge Patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐆
@P0lip Could you review and merge PR? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the yarn.lock, everything looks good to me
yarn.lock
Outdated
@@ -2444,6 +2444,25 @@ __metadata: | |||
languageName: node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you revert this yarn.lock
change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@P0lip I reverted, but it was very strange, because without execution of yarn
tests were failing. Let's see if it passes this time.
baa7c5e
to
d2bfabe
Compare
# [@stoplight/spectral-rulesets-v1.14.1](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-rulesets-v1.14.0...@stoplight/spectral-rulesets-v1.14.1) (2022-10-06) ### Bug Fixes * **rulesets:** handle empty payload and headers in AsyncAPI message's examples validation ([#2284](#2284)) ([4068221](4068221))
🎉 This PR is included in version @stoplight/spectral-rulesets-v1.14.1 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
Checklist
Does this PR introduce a breaking change?
The current rule for AsyncAPI message's examples not support use cases where payloads or headers may be empty. Also it does not merge traits in first row and then validate. That PR fix these two "bugs".