Skip to content

Commit

Permalink
fix: ensure 2+ items in each override in schema (#1628)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Sep 28, 2023
1 parent d4af0ac commit 8624892
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/generate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
items:
type: object
required: ["select"]
minProperties: 2
additionalProperties: false
properties:
select: {}
Expand Down
1 change: 1 addition & 0 deletions cibuildwheel/resources/cibuildwheel.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@
"required": [
"select"
],
"minProperties": 2,
"additionalProperties": false,
"properties": {
"select": {
Expand Down
13 changes: 13 additions & 0 deletions unit_test/validate_schema_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ def test_overrides_no_select():
validator(example)


def test_overrides_only_select():
example = tomllib.loads(
"""
[[tool.cibuildwheel.overrides]]
select = "somestring"
"""
)

validator = validate_pyproject.api.Validator()
with pytest.raises(validate_pyproject.error_reporting.ValidationError):
validator(example)


def test_docs_examples():
"""
Parse out all the configuration examples, build valid TOML out of them, and
Expand Down

0 comments on commit 8624892

Please sign in to comment.