Skip to content

test(draft2020-12): add boundary coverage for maxContains = 0#857

Open
abhi-03-kh wants to merge 1 commit intojson-schema-org:mainfrom
abhi-03-kh:feat/draft2020-12-maxcontains-zero
Open

test(draft2020-12): add boundary coverage for maxContains = 0#857
abhi-03-kh wants to merge 1 commit intojson-schema-org:mainfrom
abhi-03-kh:feat/draft2020-12-maxcontains-zero

Conversation

@abhi-03-kh
Copy link

Summary

Adds test coverage for the boundary value maxContains = 0 in the Draft 2020-12 test suite.

The specification permits maxContains to be any non-negative integer. While positive values are already covered, the boundary value 0 is currently untested.

Rationale

For the schema:

{
  "contains": { "const": 1 },
  "maxContains": 0
}

The default minContains = 1 requires at least one matching element, while maxContains = 0 prohibits any matching elements. Therefore, no array instance can satisfy both constraints.

This test ensures correct handling of the zero boundary condition and guards against implementations that do not properly enforce lower/upper bound interaction.

Scope

  • Adds a minimal test block to tests/draft2020-12/maxContains.json

  • Does not modify existing tests

  • No behavioral changes to current coverage

@abhi-03-kh abhi-03-kh requested a review from a team as a code owner February 26, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant