Skip to content

Conversation

@DannyvdSluijs
Copy link
Collaborator

This pull request introduces new validators for URI and relative references and integrates them into the FormatConstraint class. The changes also include corresponding unit tests to ensure the validators work as expected.

New Validators:

Integration into FormatConstraint:

Unit Tests:

Closing keywords

fixes #685

@DannyvdSluijs DannyvdSluijs merged commit 44f118a into master Mar 14, 2025
19 checks passed
@DannyvdSluijs DannyvdSluijs deleted the Fix-685 branch March 14, 2025 11:41
DannyvdSluijs added a commit that referenced this pull request Mar 14, 2025
… be RFC 3986 compliant (#800)

This pull request introduces new validators for URI and relative
references and integrates them into the `FormatConstraint` class. The
changes also include corresponding unit tests to ensure the validators
work as expected.

### New Validators:
*
[`src/JsonSchema/Tool/Validator/UriValidator.php`](diffhunk://#diff-2019f410f3ef4cdf8478ffa71444226beb8a118d60b3337c40eaaec8d3aef7a3R1-R65):
Added a new class `UriValidator` to validate URIs according to RFC 3986
and RFC 5322 for `mailto:` URIs.
*
[`src/JsonSchema/Tool/Validator/RelativeReferenceValidator.php`](diffhunk://#diff-0bfeeb9c38593a2d65cc2e8c49fe873c78765eac81c00cf0a398bd754ca9c7a8R1-R53):
Added a new class `RelativeReferenceValidator` to validate relative
references according to RFC 3986.

### Integration into `FormatConstraint`:
*
[`src/JsonSchema/Constraints/FormatConstraint.php`](diffhunk://#diff-44020f0c0690a2a4c1c446e97185986c31b19374b4a99f4b0970c5df36279067L104-R114):
Integrated the new `UriValidator` and `RelativeReferenceValidator` into
the `check` method to replace the previous inline validation logic for
`uri` and `uri-reference` formats.

### Unit Tests:
*
[`tests/Tool/Validator/UriValidatorTest.php`](diffhunk://#diff-6b107cb8679795fb59c070ba500d0646f6d357e4c03a585f4a0c67181e4101fcR1-R49):
Added unit tests for `UriValidator` to ensure it correctly validates
valid and invalid URIs.
*
[`tests/Tool/Validator/RelativeReferenceValidatorTest.php`](diffhunk://#diff-97a7acc2a16f7653d307a16e356c7545b0a0bc26156ce60f7ca13332a6656729R1-R40):
Added unit tests for `RelativeReferenceValidator` to ensure it correctly
validates valid and invalid relative references.

# Closing keywords
fixes #685
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URI schemas incorrectly validated with FILTER_VALIDATE_URL

2 participants