Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates regex compilation/validation so the GraalJS-backed ECMA-262 regex implementation can choose whether to apply the JavaScript Unicode (u) flag based on the schema dialect (aimed at fixing draft-04/draft-07 regex validation differences).
Changes:
- Add a schema-context-aware overload to
RegularExpressionFactory, and route regex compilation through it. - Update the GraalJS regex implementation to build RegExp functions with and without the
uflag depending onSpecificationVersion. - Add a regression test asserting draft-07 regex-format validation behavior with GraalJS.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/networknt/schema/regex/RegularExpressionTest.java | Adds a test for draft-07 format: regex behavior using GraalJS and boolean output validation. |
| src/main/java/com/networknt/schema/regex/RegularExpressionFactory.java | Introduces a default, schema-context-aware overload for obtaining compiled regexes. |
| src/main/java/com/networknt/schema/regex/RegularExpression.java | Routes compilation through the new factory overload, passing SchemaContext. |
| src/main/java/com/networknt/schema/regex/GraalJSRegularExpressionFactory.java | Selects unicode/non-unicode regex compilation based on schema dialect version. |
| src/main/java/com/networknt/schema/regex/GraalJSRegularExpressionContext.java | Builds and caches both unicode and non-unicode RegExp builders. |
| src/main/java/com/networknt/schema/regex/GraalJSRegularExpression.java | Adds a unicode toggle to choose the appropriate builder at compile time. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
• Pushed the Copilot follow-up to PR #1249. Commit: bae63a9 Address regex factory review comments What changed:
|
| SpecificationVersion dialect = schemaContext != null | ||
| ? schemaContext.getDialect().getSpecificationVersion() | ||
| : null; | ||
| boolean unicode = dialect == null | ||
| || dialect.getOrder() >= SpecificationVersion.DRAFT_2019_09.getOrder(); |
|
• Addressed the new Copilot comment on PR #1249 and pushed it. Commit: 03dc296 Rename regex specification version variable Change made:
|
* fixes #1248 validating draft4 schemas (#1249) * fixes #1248 validating draft4 schemas * Address regex factory review comments * Rename regex specification version variable * fixes #1174 TextNodes as schema seem to validate any value (#1250) * fixes #1174 TextNodes as schema seem to validate any value * Address loaded schema validation for issue 1174 * Address schema node validation review comments * Preserve mapped schema override path * Validate referenced document fragment schemas * Remove duplicate schema type validation * Validate loaded schemas for anchor refs * fixes #1252 problem with additionalProperties schema in jsconfig schema (#1253) * Add method to SpecificationVersion to determine from schema node (#1221) * Manual adjustments for Jackson 2 compatibility and CVE fix --------- Co-authored-by: Justin Tay <[email protected]>
No description provided.