Skip to content

feat: Add Draft-2019-09#885

Draft
DannyvdSluijs wants to merge 19 commits into
mainfrom
Add-Draft-2019-09-support
Draft

feat: Add Draft-2019-09#885
DannyvdSluijs wants to merge 19 commits into
mainfrom
Add-Draft-2019-09-support

Conversation

@DannyvdSluijs
Copy link
Copy Markdown
Collaborator

Description

This PR aims to add Draft 2019 support to JSON Schema for PHP, it is still. a work in progress.

Related Issue

N/A/

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Other (please describe):

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the code style of this project
  • I have added tests that prove my fix is effective or that my feature works
  • All new and existing tests pass
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional Notes

None

@DannyvdSluijs DannyvdSluijs force-pushed the Add-Draft-2019-09-support branch 3 times, most recently from 65eaaf5 to 65e95cd Compare February 18, 2026 20:02
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependencies might no longer be in this draft.

@DannyvdSluijs DannyvdSluijs force-pushed the Add-Draft-2019-09-support branch from 746fab9 to 3886d6b Compare March 28, 2026 08:03
@DannyvdSluijs DannyvdSluijs force-pushed the Add-Draft-2019-09-support branch 2 times, most recently from 746fab9 to d0c5240 Compare May 4, 2026 20:26
github-actions Bot and others added 6 commits May 4, 2026 21:31
## Description
This PR updates the JSON Schema test-suite to use the main branch. This
adds some additional test for the property names constraint in draft 06
and 07 for the const and enum.

## Related Issue
- Fixes #905 

## Type of Change
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Documentation update
- [ ] Code refactoring
- [ ] Other (please describe):

## Checklist
- [X] I have read the [CONTRIBUTING](CONTRIBUTING.md) guidelines
- [X] My code follows the code style of this project
- [X] I have added tests that prove my fix is effective or that my
feature works
- [X] All new and existing tests pass
- [X] I have updated the documentation accordingly
- [X] My changes generate no new warnings
## Description
Fixes the error message for additional properties to show the property
name instead of the value.

Before:
```
The property 41.53824,2.42572 is not defined and the definition does not allow additional properties
```
After:
```
The property coordinates is not defined and the definition does not allow additional properties
```

## Type of Change
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Documentation update
- [ ] Code refactoring
- [ ] Other (please describe):

## Checklist
- [x] I have read the [CONTRIBUTING](CONTRIBUTING.md) guidelines
- [x] My code follows the code style of this project
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] All new and existing tests pass
- [x] I have updated the documentation accordingly
- [x] My changes generate no new warnings
Due to a workflow failure this entry was added manually.
@DannyvdSluijs DannyvdSluijs changed the title feat: Add draft2019 as copy from draft07 feat: Add draft2019 May 13, 2026
@DannyvdSluijs DannyvdSluijs changed the title feat: Add draft2019 feat: Add Draft-2019-09 May 13, 2026
@DannyvdSluijs DannyvdSluijs force-pushed the Add-Draft-2019-09-support branch from 6aedc26 to 72e285d Compare May 13, 2026 18:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial JSON Schema Draft 2019-09 support to the PHP validator by introducing a Draft2019 constraint set, wiring it into the global constraint factory, and enabling the JSON Schema Test Suite draft2019-09 directory (with a large explicit skip list for currently unsupported/incorrect cases).

Changes:

  • Registers a new draft2019-09 constraint entry in the main JsonSchema\Constraints\Factory.
  • Introduces a new JsonSchema\Constraints\Drafts\Draft2019 constraint factory + keyword constraints (type, refs, applicators, validation keywords, etc.).
  • Updates tests to include draft2019-09 in strict-mode handling and to run the Test Suite draft2019-09 folder while skipping many currently failing cases; adds new minContains/maxContains errors.

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/ValidatorTest.php Treats Draft 2019-09 as supported for strict-mode default dialect resolution.
tests/JsonSchemaTestSuiteTest.php Enables running draft2019-09 tests; expands skip list; updates check-mode typing and strict-mode mapping for draft2019-09.
src/JsonSchema/Constraints/Factory.php Registers draft2019-09 to map to the new Draft2019 constraint implementation.
src/JsonSchema/ConstraintError.php Adds MAX_CONTAINS / MIN_CONTAINS error types and messages used by Draft2019 contains handling.
src/JsonSchema/Constraints/Drafts/Draft2019/Factory.php Draft2019-specific constraint map for keyword dispatch.
src/JsonSchema/Constraints/Drafts/Draft2019/Draft2019Constraint.php Draft2019 schema constraint orchestrating keyword checks (including dependent* keywords).
src/JsonSchema/Constraints/Drafts/Draft2019/AdditionalPropertiesConstraint.php Draft2019 additionalProperties keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/AdditionalItemsConstraint.php Draft2019 additionalItems keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/AllOfConstraint.php Draft2019 allOf applicator handling.
src/JsonSchema/Constraints/Drafts/Draft2019/AnyOfConstraint.php Draft2019 anyOf applicator handling.
src/JsonSchema/Constraints/Drafts/Draft2019/OneOfConstraint.php Draft2019 oneOf applicator handling.
src/JsonSchema/Constraints/Drafts/Draft2019/NotConstraint.php Draft2019 not applicator handling.
src/JsonSchema/Constraints/Drafts/Draft2019/IfThenElseConstraint.php Draft2019 if/then/else applicator handling.
src/JsonSchema/Constraints/Drafts/Draft2019/RefConstraint.php Draft2019 $ref resolution and validation.
src/JsonSchema/Constraints/Drafts/Draft2019/PropertiesConstraint.php Draft2019 properties keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/PatternPropertiesConstraint.php Draft2019 patternProperties keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/PropertiesNamesConstraint.php Draft2019 propertyNames keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/ItemsConstraint.php Draft2019 items keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/ContainsConstraint.php Draft2019 contains + minContains/maxContains handling.
src/JsonSchema/Constraints/Drafts/Draft2019/TypeConstraint.php Draft2019 type keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/EnumConstraint.php Draft2019 enum keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/ConstConstraint.php Draft2019 const keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/RequiredConstraint.php Draft2019 required keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/UniqueItemsConstraint.php Draft2019 uniqueItems keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/MinItemsConstraint.php Draft2019 minItems keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/MaxItemsConstraint.php Draft2019 maxItems keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/MinPropertiesConstraint.php Draft2019 minProperties keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/MaxPropertiesConstraint.php Draft2019 maxProperties keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/MinLengthConstraint.php Draft2019 minLength keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/MaxLengthConstraint.php Draft2019 maxLength keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/MinimumConstraint.php Draft2019 minimum keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/MaximumConstraint.php Draft2019 maximum keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/ExclusiveMinimumConstraint.php Draft2019 exclusiveMinimum keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/ExclusiveMaximumConstraint.php Draft2019 exclusiveMaximum keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/MultipleOfConstraint.php Draft2019 multipleOf keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/FormatConstraint.php Draft2019 format keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/PatternConstraint.php Draft2019 pattern keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/DependenciesConstraint.php Draft2019 legacy dependencies keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/DependentSchemasConstraint.php Draft2019 dependentSchemas keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/DependentRequiredConstraint.php Draft2019 dependentRequired keyword handling.
src/JsonSchema/Constraints/Drafts/Draft2019/ContentConstraint.php Draft2019 content* keyword placeholder/stub.
Comments suppressed due to low confidence (4)

src/JsonSchema/Constraints/Drafts/Draft2019/FormatConstraint.php:212

  • validatePhone() currently returns true when preg_match() returns 0 (no match), because it checks !== false. This makes the phone format validation effectively always pass unless the regex errors. Compare the result to === 1 instead.
    private function validatePhone(string $phone): bool
    {
        return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone) !== false;
    }

tests/JsonSchemaTestSuiteTest.php:203

  • Typo in skipped test name: "doest" -> "does" (currently the string likely won’t match the actual test name, so the intended skip may not apply).
    tests/JsonSchemaTestSuiteTest.php:258
  • Typo in skipped test name: "evalation" -> "evaluation" (if the actual test name uses the correct spelling, this skip entry won’t match).
    tests/JsonSchemaTestSuiteTest.php:210
  • Repeated word in skipped test names: "with with" -> "with". If the upstream test names don’t contain this duplication, these skip entries won’t match and won’t be applied.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/JsonSchema/Constraints/Drafts/Draft2019/MultipleOfConstraint.php Outdated
Comment thread src/JsonSchema/Constraints/Drafts/Draft2019/FormatConstraint.php
Comment thread src/JsonSchema/Constraints/Drafts/Draft2019/AdditionalPropertiesConstraint.php Outdated
Comment thread tests/JsonSchemaTestSuiteTest.php Outdated
Comment thread tests/JsonSchemaTestSuiteTest.php Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 51 out of 51 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

src/JsonSchema/Constraints/Drafts/Draft06/FormatConstraint.php:172

  • Minor style: ===1 should be spaced as === 1 for consistency with the surrounding code and typical PHP CS fixer rules.
    private function validatePhone(string $phone): bool
    {
        return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone) ===1;
    }

private function validateRegex(string $regex): bool
{
return preg_match(self::jsonPatternToPhpRegex($regex), '') !== false;
return preg_match(self::jsonPatternToPhpRegex($regex), '') === 1;
private function validateRegex(string $regex): bool
{
return preg_match(self::jsonPatternToPhpRegex($regex), '') !== false;
return preg_match(self::jsonPatternToPhpRegex($regex), '') === 1;

private function validateRegex(string $regex): bool
{
return preg_match(self::jsonPatternToPhpRegex($regex), '') === 1;
Comment thread composer.json
Comment on lines 34 to 67
@@ -59,11 +59,11 @@
"type": "package",
"package": {
"name": "json-schema/json-schema-test-suite",
"version": "23.2.0",
"version": "dev-main",
"source": {
"type": "git",
"url": "https://github.com/json-schema/JSON-Schema-Test-Suite",
"reference": "23.2.0"
"reference": "main"
}
Comment thread CHANGELOG.md
Comment on lines 8 to +16
## [Unreleased]

### Fixed
- Display the additional property on error instead of the value ([#904](https://github.com/jsonrainbow/json-schema/pull/904))

## [6.8.2] - 2026-05-05

### Fixed
- Update to json schema test suite main branch ([#906](https://github.com/jsonrainbow/json-schema/pull/906))
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.

3 participants