Skip to content

Commit c957e91

Browse files
Add boolean and null cases to draft-04 , draft-06 and v1
1 parent 0650027 commit c957e91

8 files changed

Lines changed: 118 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Add edge case tests for exclusiveMinimum and exclusiveMaximum keywords
2+
3+
The `exclusiveMinimum` and `exclusiveMaximum` test files currently contain only a single test case each across all draft versions. Coverage is limited to basic positive floats (e.g. `exclusiveMinimum: 1.1`, `exclusiveMaximum: 3.0`), with no tests for zero, negatives, integer boundaries, very large or very small numbers, or interaction with `minimum` / `maximum`. Expanding these tests would help validator implementations handle boundary conditions correctly and align coverage with the richer edge cases already present in `minimum.json` and `maximum.json`.
4+
5+
---
6+
7+
### Motivation
8+
9+
Implementations need to correctly handle exclusive bounds in a variety of numeric scenarios. The specification defines `exclusiveMinimum` and `exclusiveMaximum` for numeric validation; the suite should exercise integer boundaries, zero, negative numbers, and (where appropriate) extreme values. Tests that combine `exclusiveMinimum`/`exclusiveMaximum` with `minimum`/`maximum` would also clarify expected behavior when both are present. Better coverage here reduces the risk of validators misbehaving on real-world schemas that use these keywords.
10+
11+
### Current tests
12+
13+
Each of the following files contains only **one test case** (one schema plus its tests):
14+
15+
**exclusiveMinimum**
16+
17+
- [tests/draft7/exclusiveMinimum.json](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft7/exclusiveMinimum.json)
18+
- [tests/draft2019-09/exclusiveMinimum.json](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2019-09/exclusiveMinimum.json)
19+
- [tests/draft2020-12/exclusiveMinimum.json](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/exclusiveMinimum.json)
20+
- [tests/v1/exclusiveMinimum.json](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/v1/exclusiveMinimum.json)
21+
22+
**exclusiveMaximum**
23+
24+
- [tests/draft7/exclusiveMaximum.json](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft7/exclusiveMaximum.json)
25+
- [tests/draft2019-09/exclusiveMaximum.json](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2019-09/exclusiveMaximum.json)
26+
- [tests/draft2020-12/exclusiveMaximum.json](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/exclusiveMaximum.json)
27+
- [tests/v1/exclusiveMaximum.json](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/v1/exclusiveMaximum.json)
28+
29+
**Affected drafts:** draft-07, draft-2019-09, draft-2020-12, and v1. Representative links: [draft7](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft7/exclusiveMinimum.json), [draft2019-09](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2019-09/exclusiveMinimum.json), [draft2020-12](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/exclusiveMinimum.json), [v1](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/v1/exclusiveMinimum.json).
30+
31+
### Proposed additions
32+
33+
- **Integer boundaries:** Test cases where the bound is an integer (e.g. `exclusiveMinimum: 0`, `exclusiveMaximum: 10`) and instances use both integer and float representations (e.g. `0` vs `0.0`, `10` vs `10.0`) to assert correct exclusive comparison.
34+
- **Zero:** Explicit tests for zero as either the bound or the instance (e.g. `exclusiveMinimum: 0` with valid `0.1` and invalid `0`; `exclusiveMaximum: 0` with valid `-0.1` and invalid `0`).
35+
- **Negative numbers:** Test cases with negative bounds and/or negative instances (e.g. `exclusiveMinimum: -2`, `exclusiveMaximum: -1`) to cover signed comparisons.
36+
- **Very large and very small numbers:** Edge cases with large or small finite values (within normal JSON number range). Implementation-specific overflow behavior may follow existing optional patterns (e.g. [tests/draft2020-12/optional/bignum.json](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/optional/bignum.json), [tests/draft2020-12/optional/float-overflow.json](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/optional/float-overflow.json)) where relevant.
37+
- **Interaction with `minimum` / `maximum`:** Test cases where both `minimum` and `exclusiveMinimum`, or both `maximum` and `exclusiveMaximum`, appear in the same schema, to assert that implementations apply the exclusive bound correctly when used together.
38+
39+
### Implementation notes
40+
41+
- Follow the [CONTRIBUTING](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/CONTRIBUTING.md) guidelines: use **minimal** schemas (only keywords under test) and prefer simpler instances where possible.
42+
- Include both **valid** and **invalid** instances for each new test case where the schema allows either outcome; see the [README](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/README.md) test structure.
43+
- Add new test cases to **all applicable draft versions** (draft-07, draft-2019-09, draft-2020-12, v1), with any draft-specific adjustments (e.g. `$id` vs `id`, `$schema` usage) as needed.
44+
- Before adding tests, review the spec sections for [exclusiveMinimum](https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-01#name-exclusiveminimum) and [exclusiveMaximum](https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-01#name-exclusivemaximum) to ensure the new cases match specified behavior.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,6 @@ cython_debug/
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160
#.idea/
161+
162+
# Snyk Security Extension - AI Rules (auto-generated)
163+
.github/instructions/snyk_rules.instructions.md

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"snyk.advanced.organization": "92c55a6f-130f-4419-9150-6076a9bd8014",
3+
"snyk.advanced.autoSelectOrganization": true
4+
}

github-issue-empty-null.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
**Title:** Add tests for empty and null value edge cases
2+
3+
The suite does not yet systematically cover empty arrays, empty objects, empty strings, and `null` instances across the relevant keywords. These are common real‑world edge cases, and adding targeted tests would help validators behave consistently. Many core keywords may be affected (e.g. `type`, `minItems` / `maxItems`, `minLength` / `maxLength`, `required`), but the scope can stay descriptive; the gaps are straightforward to identify, the tests are simple to write and follow existing patterns, and they are a good way to learn the test structure and contributing guidelines.
4+
5+
### Proposed scope
6+
7+
- **Review existing tests** for key structural and validation keywords and identify where empty/null cases are missing (empty `[]`, `{}`, `""`, and `null` as instance values).
8+
- **Add minimal schemas plus instances** that include those values, with both valid and invalid outcomes where the schema allows either.
9+
- **Follow existing test patterns and directory structure**; keep new tests small and focused, and add them to all applicable draft versions per [CONTRIBUTING](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/CONTRIBUTING.md).

github-issue.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Add boundary value tests for numeric keywords
2+
3+
The current numeric keyword tests (`minimum`, `maximum`, `multipleOf`, `exclusiveMinimum`, `exclusiveMaximum`) have limited boundary-value coverage for very large/small numbers and precision limits. Expanding these tests would help ensure validators handle numeric edge cases correctly across different implementations and platforms.
4+
5+
## Current tests
6+
7+
Representative numeric keyword test files across drafts:
8+
9+
- **draft-2020-12**: [`tests/draft2020-12/minimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/minimum.json), [`tests/draft2020-12/maximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/maximum.json), [`tests/draft2020-12/multipleOf.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/multipleOf.json), [`tests/draft2020-12/exclusiveMinimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/exclusiveMinimum.json), [`tests/draft2020-12/exclusiveMaximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/exclusiveMaximum.json)
10+
- **draft-2019-09**: [`tests/draft2019-09/minimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2019-09/minimum.json), [`tests/draft2019-09/maximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2019-09/maximum.json), [`tests/draft2019-09/multipleOf.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2019-09/multipleOf.json), [`tests/draft2019-09/exclusiveMinimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2019-09/exclusiveMinimum.json), [`tests/draft2019-09/exclusiveMaximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2019-09/exclusiveMaximum.json)
11+
- **draft-07**: [`tests/draft7/minimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft7/minimum.json), [`tests/draft7/maximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft7/maximum.json), [`tests/draft7/multipleOf.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft7/multipleOf.json), [`tests/draft7/exclusiveMinimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft7/exclusiveMinimum.json), [`tests/draft7/exclusiveMaximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft7/exclusiveMaximum.json)
12+
- **draft-06**: [`tests/draft6/minimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft6/minimum.json), [`tests/draft6/maximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft6/maximum.json), [`tests/draft6/multipleOf.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft6/multipleOf.json), [`tests/draft6/exclusiveMinimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft6/exclusiveMinimum.json), [`tests/draft6/exclusiveMaximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft6/exclusiveMaximum.json)
13+
- **draft-04**: [`tests/draft4/minimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft4/minimum.json), [`tests/draft4/maximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft4/maximum.json), [`tests/draft4/multipleOf.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft4/multipleOf.json)
14+
- **draft-03**: [`tests/draft3/minimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft3/minimum.json), [`tests/draft3/maximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft3/maximum.json)
15+
- **v1**: [`tests/v1/minimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/v1/minimum.json), [`tests/v1/maximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/v1/maximum.json), [`tests/v1/multipleOf.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/v1/multipleOf.json), [`tests/v1/exclusiveMinimum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/v1/exclusiveMinimum.json), [`tests/v1/exclusiveMaximum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/v1/exclusiveMaximum.json)
16+
17+
## Proposed additions
18+
19+
- Large integers near JavaScript's `Number.MAX_SAFE_INTEGER` (2^53 − 1) and `Number.MIN_SAFE_INTEGER` (−2^53 + 1) for `minimum`/`maximum`/`exclusiveMinimum`/`exclusiveMaximum`
20+
- Very small floating-point numbers near zero (e.g., 1e-308, -1e-308) for boundary validation
21+
- Precision limit edge cases for `multipleOf` (e.g., very small divisors, floating-point precision boundaries)
22+
- Large floating-point numbers approaching implementation limits
23+
24+
## Implementation notes
25+
26+
- Use minimal schemas focusing on the numeric keyword being tested
27+
- Add tests to all applicable drafts (draft-03 through draft-2020-12, and v1 where the keyword exists)
28+
- Tests for implementation-specific numeric precision limits (e.g., beyond IEEE 754 double precision) should be placed in `optional/` directories, following the pattern of [`optional/bignum.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/optional/bignum.json) and [`optional/float-overflow.json`](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/main/tests/draft2020-12/optional/float-overflow.json)

tests/draft4/required.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@
3333
"description": "ignores other non-objects",
3434
"data": 12,
3535
"valid": true
36+
},
37+
{
38+
"description": "ignores null",
39+
"data": null,
40+
"valid": true
41+
},
42+
{
43+
"description": "ignores boolean",
44+
"data": true,
45+
"valid": true
3646
}
3747
]
3848
},

tests/draft6/required.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@
3333
"description": "ignores other non-objects",
3434
"data": 12,
3535
"valid": true
36+
},
37+
{
38+
"description": "ignores null",
39+
"data": null,
40+
"valid": true
41+
},
42+
{
43+
"description": "ignores boolean",
44+
"data": true,
45+
"valid": true
3646
}
3747
]
3848
},

tests/v1/required.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@
3434
"description": "ignores other non-objects",
3535
"data": 12,
3636
"valid": true
37+
},
38+
{
39+
"description": "ignores null",
40+
"data": null,
41+
"valid": true
42+
},
43+
{
44+
"description": "ignores boolean",
45+
"data": true,
46+
"valid": true
3747
}
3848
]
3949
},

0 commit comments

Comments
 (0)