Repository navigation
Fix additionalProperties matching with pattern backreferences - #141
Kaileshwar16 wants to merge 1 commit into
Conversation
jdesrosiers
left a comment
There was a problem hiding this comment.
Thanks for working on this. Unfortunately, I can't accept this because it changes the compiled value of additionalProperties.
Other packages read the compiled keyword values either through EvaluationPlugins or by working with the AST directly. They expect [RegExp, string], so changing the shape breaks them.
Also, the convention in this repo is to test through the JSON Schema Test Suite. Remove your tests and add them there so everyone gets them.
|
@jdesrosiers I checked the compatibility issue, and the simpler fixes dont seem reliable. A proper fix might need regex-aware rewriting, which seems like a lot of complexity for this edge case. imo, it might not be worth adding that much complexity. Would you suggest another approach, or should we close this pr for now ? |
|
I think it's ok to close for now. It's a pretty obscure edge case. |
Fixes #138.
additionalPropertiescombinespatternPropertiespatterns into one regex, which changes capture group numbering. With^(a)\1$and^(b)\1$, this incorrectly rejectsbband acceptsb.Compile each pattern independently and check literal
propertiesnames separately. This preserves backreference behavior and supports validator serialization.Adds regression coverage across six JSON Schema dialects, including named captures, serialization, and interaction with
unevaluatedProperties.Validation: