fix: allow payload property named message with null value - #1247
Open
AayushSaini101 wants to merge 1 commit into
Open
AayushSaini101 wants to merge 1 commit into
AayushSaini101 wants to merge 1 commit into
Conversation
Add null guards to JSONPath filters that matched payload schema fields named message and crashed when accessing schemaFormat on null values. Co-authored-by: Cursor <cursoragent@cursor.com>
AayushSaini101
requested review from
asyncapi-bot-eve,
magicmatatjahu and
princerajpoot20
as code owners
September 12, 2026 08:09
🦋 Changeset detectedLatest commit: 34f8920 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



closes#863:
Related: #1203
parsing/validating an AsyncAPI 2.x document no longer crashes when a payload schema defines a property named
messagewith anullexample value.The issue occurred because several v2 Spectral rule JSONPath filters used expressions like:
jsonpath-plusevaluates these filters while traversing the document tree. Any property namedmessagematched the filter — including payload schema fields, not just AsyncAPI Message Objects. When that value wasnull, accessing@.schemaFormatthrew:This fix adds
!@nullguards before property access on@, consistent with other filters already in the ruleset.Changes
!@null &&guards to 8 JSONPath filters inpackages/parser/src/ruleset/v2/ruleset.tsasyncapi2-message-examplesasyncapi2-schema-defaultasyncapi2-schema-examplesasyncapi2-message-messageId!@null &&guards to 2 JSONPath filters inmessageExamples-spectral-rule-v2.tsvalidate.spec.tsusingparser.parse()Test plan
payload.properties.messageallowingnullandexamples[0].payload.message: nullCannot read properties of nulldiagnosticuncaught-errordiagnosticasyncapi2-message-examples,asyncapi2-schema-examples,asyncapi2-schema-default, andasyncapi2-message-messageIdCloses #863