Handle inline regex modifiers and invalid schema patterns in hover#1244
Merged
datho7561 merged 2 commits intoredhat-developer:mainfrom May 1, 2026
Merged
Handle inline regex modifiers and invalid schema patterns in hover#1244datho7561 merged 2 commits intoredhat-developer:mainfrom
datho7561 merged 2 commits intoredhat-developer:mainfrom
Conversation
…hover Signed-off-by: Morgan Chang <shin19991207@gmail.com>
Signed-off-by: Morgan Chang <shin19991207@gmail.com>
datho7561
approved these changes
May 1, 2026
Contributor
datho7561
left a comment
There was a problem hiding this comment.
Seems reasonable to me.
Side node: kind of silly that ajv doesn't report if the regex is invalid when validating the schema.
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.
What does this PR do?
(?s),(?m),(?i), and their combined forms such as(?ms)/(?sm). Note that these modifiers are not part of the "portable JSON Schema regex guidance" documented at https://json-schema.org/understanding-json-schema/reference/regular_expressions, but I think supporting them is useful for schemas.Invalid pattern: "..."when a schema uses unsupported regex syntaxRequest textDocument/hover failed with message: Invalid regular expression: .... Both validation and hover should now continue to work even when schemas contain inline modifiers or unsupported patterns.What issues does this PR fix or reference?
Fixes #874
Is it tested? How?
test-pattern-schema.json:{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "caseInsensitiveField": { "type": "string", "description": "Field with case-insensitive pattern.", "pattern": "(?i)^(yes|no)$" }, "multilineOnly": { "type": "string", "description": "Field with multiline pattern.", "pattern": "(?m)^start.*end$" }, "dotallOnly": { "type": "string", "description": "Field with dotall pattern.", "pattern": "(?s)^start.*end$" }, "multilineAndDotallCombinedFlags": { "type": "string", "description": "Field with multiline and dotall pattern.", "pattern": "(?ms)^start.*end$" }, "dotallAndCaseInsensitiveFieldFlags": { "type": "string", "description": "Field with dotall and case-insensitive pattern.", "pattern": "(?s)(?i)test.*content" }, "allFlags": { "type": "string", "description": "Field with case-insensitive, multiline, and dotall pattern.", "pattern": "(?ims)^START.*END$" }, "unsupportedPattern": { "type": "string", "description": "Field with unsupported pattern.", "pattern": "(?x)text .*" } } }