Skip to content

feat: Support the dependencies keyword in Draft 2019-09 for compatibility - #1006

Merged
DannyvdSluijs merged 1 commit into
jsonrainbow:mainfrom
Roman3349:feat/dependencies-compatibility
Nov 27, 2026
Merged

DannyvdSluijs merged 1 commit into
jsonrainbow:mainfrom
Roman3349:feat/dependencies-compatibility

Conversation

@Roman3349

Copy link
Copy Markdown
Contributor

Description

Draft 2019-09 split dependencies into dependentRequired and dependentSchemas, so the Draft 2019-09 constraints ignored dependencies. A schema written for an earlier draft and moved to Draft 2019-09 without renaming the keyword silently accepted objects with missing dependencies.

The JSON Schema Test Suite covers this backwards compatibility as an optional feature in optional/dependencies-compatibility.json. This adds it, so dependencies keeps working as it did in Draft-07.

Changes:

  • Draft2019\DependenciesConstraint: a copy of the Draft-07 constraint, handling both the property array form and the schema form.
  • Draft2019\Factory, Draft2019Constraint: register and check dependencies next to dependentSchemas and dependentRequired.
  • JsonSchemaTestSuiteTest: removes the 14 skipped optional/dependencies-compatibility.json cases, which all pass now.

Related Issue

None

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

Properties evaluated by the schema form of dependencies are not taken into account by unevaluatedProperties, unlike those of dependentSchemas. dependencies is not part of the Draft 2019-09 applicator vocabulary, and the test suite only covers its assertions.

#971 (Draft 2020-12) includes this commit and applies it to Draft 2020-12 as well.

…lity

Signed-off-by: Roman Ondráček <mail@romanondracek.cz>
@DannyvdSluijs
DannyvdSluijs merged commit 1952638 into jsonrainbow:main Nov 27, 2026
19 checks passed
github-actions Bot added a commit that referenced this pull request Nov 27, 2026
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.

2 participants