Draft: Issue #3643475: Add safe Regex constraint keywords to JSON Schema

Adds JsonSchemaConstraintInterface to RegexConstraint so supported PCRE patterns contribute JSON Schema keywords.

The supported subset includes ASCII literals, positive ASCII character classes, capturing and noncapturing groups, alternation, ordinary and lazy quantifiers, and anchors. Selected unpaired delimiters and the optional Unicode modifier are supported.

Preserves Drupal’s acceptance of empty strings and PCRE’s final-LF end-anchor behavior. Unsupported patterns, normalizer callbacks, and match: FALSE contribute no keywords.

Adds unit coverage for supported and unsupported conversions, plus kernel coverage for generated schemas, validation, empty strings, newline behavior, and nullable values.

Dependency: Requires the interface and normalizer integration from #3627330: 18061

This branch is based on parent commit 2ac710fc5ed. Keep as draft pending review of the conversion rules and the parent dependency. Rebase onto main after the parent merges.

Local validation on PHP 8.5.13:

  • Regex unit tests: 28 tests, 30 assertions passed.
  • Regex kernel tests: 11 tests, 33 assertions passed.
  • CSpell, PHPStan, PHPCS, and whitespace checks passed.

AI assistance: ChatGPT helped draft this message.

Merge request reports

Loading
Loading