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.
Contributor
Author
|
• Pushed the Copilot follow-up to PR #1249. Commit: bae63a9 Address regex factory review comments What changed:
|
Comment on lines
+71
to
+75
| SpecificationVersion dialect = schemaContext != null | ||
| ? schemaContext.getDialect().getSpecificationVersion() | ||
| : null; | ||
| boolean unicode = dialect == null | ||
| || dialect.getOrder() >= SpecificationVersion.DRAFT_2019_09.getOrder(); |
Contributor
Author
|
• Addressed the new Copilot comment on PR #1249 and pushed it. Commit: 03dc296 Rename regex specification version variable Change made:
|
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.
No description provided.