-
-
Notifications
You must be signed in to change notification settings - Fork 96
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: null check when checking schemaFormat in array items #786
fix: null check when checking schemaFormat in array items #786
Conversation
due to a quirk of how nimma generates the evaluation logic for checking fields in objects inside an array whilst filtering it is possible to get an npe. Adding specific checks against this. Contributes to: asyncapi#784 Signed-off-by: Chris Patmore <[email protected]>
@@ -31,6 +31,7 @@ export function testRule(ruleName: RuleNames, tests: Scenario,): void { | |||
const doc = JSON.stringify(testCase.document); | |||
|
|||
const errors = await parser.validate(doc); | |||
expect(errors.filter(({ code }) => code === 'uncaught-error')).toHaveLength(0); |
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.
test wasn't seeing the uncaught errors which threw me for a long time
@@ -123,17 +123,17 @@ export const v2CoreRuleset = { | |||
given: [ | |||
// messages | |||
'$.channels.*.[publish,subscribe].[?(@property === \'message\' && @.schemaFormat === void 0)]', | |||
'$.channels.*.[publish,subscribe].message.oneOf[?(@.schemaFormat === void 0)]', | |||
'$.channels.*.[publish,subscribe].message.oneOf[?(!@null && @.schemaFormat === void 0)]', |
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 null check anywhere we are checking the value of a property inside an object
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
👍
/rtm |
🎉 This PR is included in version 2.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
due to a quirk of how nimma generates the evaluation logic for checking fields in objects inside an array whilst filtering it is possible to get an npe. Adding specific checks against this.
Related issue(s)
Fixes #784