fix: allow $refs to component messages with special characters in names#1143
Open
armorbreak001 wants to merge 1 commit intoasyncapi:masterfrom
Open
fix: allow $refs to component messages with special characters in names#1143armorbreak001 wants to merge 1 commit intoasyncapi:masterfrom
armorbreak001 wants to merge 1 commit intoasyncapi:masterfrom
Conversation
The ajv-formats uri-reference format validator incorrectly rejects valid URI references containing square brackets ([, ]), which are legal per RFC 3986 and RFC 6901. This caused false validation failures for $refs pointing to components whose keys contain special characters (e.g. JMS message names like "test:[HandleFirst,HandleSecond]"). Fixes asyncapi#1132
|
|
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.



Fixes #1132
Problem
The parser incorrectly rejected valid
$refsto component messages whose names contain square brackets (e.g., JMS-style names liketest:[HandleFirst,HandleSecond]:SubscribeMessage).Root cause: The
ajv-formatslibrary'suri-referenceformat validator rejects URI references containing square brackets, even though they are legal per RFC 3986 and RFC 6901. This caused a cascade of false validation failures:$refvalue failed format validation → Reference schema rejectedoneOfvalidation failed → reported as "Referencing in this place is not allowed"Fix
In the unresolved schema validation, remove the
formatconstraint fromReferenceObject.jsondefinitions. The format check foruri-referenceon$reffields provides little practical benefit (Spectral's ref resolver already validates resolvability) and causes false positives for valid documents.How to verify