Skip to content

Commit

Permalink
Require two elements in covering elements (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr authored May 6, 2024
1 parent 3b5483b commit 0128483
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
12 changes: 8 additions & 4 deletions format-specs/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,35 @@
{ "type": "string" },
{ "const": "xmin" }
],
"additionalItems": false
"minItems": 2,
"maxItems": 2
},
"xmax": {
"type": "array",
"items": [
{ "type": "string" },
{ "const": "xmax" }
],
"additionalItems": false
"minItems": 2,
"maxItems": 2
},
"ymin": {
"type": "array",
"items": [
{ "type": "string" },
{ "const": "ymin" }
],
"additionalItems": false
"minItems": 2,
"maxItems": 2
},
"ymax": {
"type": "array",
"items": [
{ "type": "string" },
{ "const": "ymax" }
],
"additionalItems": false
"minItems": 2,
"maxItems": 2
}
}
}
Expand Down
20 changes: 20 additions & 0 deletions scripts/test_json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,26 @@ def get_version() -> str:
}
valid_cases["valid_but_not_bbox_struct_name"] = metadata

metadata = copy.deepcopy(metadata_covering_template)
metadata["columns"]["geometry"]["covering"]["bbox"]["xmin"] = []
invalid_cases["xmin_array_length_must_be_2_is_0"] = metadata

metadata = copy.deepcopy(metadata_covering_template)
metadata["columns"]["geometry"]["covering"]["bbox"]["ymax"] = []
invalid_cases["ymax_array_length_must_be_2_is_0"] = metadata

metadata = copy.deepcopy(metadata_covering_template)
metadata["columns"]["geometry"]["covering"]["bbox"]["ymin"] = ["column"]
invalid_cases["ymin_array_length_must_be_2_is_1"] = metadata

metadata = copy.deepcopy(metadata_covering_template)
metadata["columns"]["geometry"]["covering"]["bbox"]["xmax"] = ["column"]
invalid_cases["xmax_array_length_must_be_2_is_1"] = metadata

metadata = copy.deepcopy(metadata_covering_template)
metadata["columns"]["geometry"]["covering"]["bbox"]["xmin"] = ["xmin", "xmin", "xmin"]
invalid_cases["xmin_array_length_must_be_2_is_3"] = metadata

metadata = copy.deepcopy(metadata_covering_template)
metadata["columns"]["geometry"]["covering"].pop("bbox")
invalid_cases["empty_geometry_bbox"] = metadata
Expand Down

0 comments on commit 0128483

Please sign in to comment.