Skip to content

Commit 4bf2b10

Browse files
authored
Handle STAC items without bbox (#639)
1 parent f000e9a commit 4bf2b10

File tree

3 files changed

+19
-28
lines changed

3 files changed

+19
-28
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
__pycache__/
1111
.ipynb_checkpoints/
1212
/.venv
13+
/node_modules/

.pre-commit-config.yaml

+13-25
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,12 @@ repos:
77
language: system
88
types: [python]
99
require_serial: true
10-
- id: check-added-large-files
11-
name: Check for added large files
12-
entry: check-added-large-files
13-
language: system
14-
- id: check-toml
15-
name: Check Toml
16-
entry: check-toml
17-
language: system
18-
types: [toml]
19-
- id: check-yaml
20-
name: Check Yaml
21-
entry: check-yaml
22-
language: system
23-
types: [yaml]
2410
- id: darglint
2511
name: darglint
2612
entry: darglint
2713
language: system
2814
types: [python]
2915
stages: [manual]
30-
- id: end-of-file-fixer
31-
name: Fix End of Files
32-
entry: end-of-file-fixer
33-
language: system
34-
types: [text]
35-
stages: [commit, push, manual]
3616
- id: flake8
3717
name: flake8
3818
entry: flake8
@@ -54,14 +34,22 @@ repos:
5434
language: system
5535
types: [python]
5636
args: [--py37-plus]
37+
- repo: https://github.com/pre-commit/pre-commit-hooks
38+
rev: v5.0.0
39+
hooks:
40+
- id: check-added-large-files
41+
- id: check-toml
42+
types: [toml]
43+
- id: check-yaml
44+
types: [yaml]
45+
- id: end-of-file-fixer
46+
types: [text]
47+
stages: [pre-commit, pre-push, manual]
5748
- id: trailing-whitespace
58-
name: Trim Trailing Whitespace
59-
entry: trailing-whitespace-fixer
60-
language: system
6149
types: [text]
62-
stages: [commit, push, manual]
50+
stages: [pre-commit, pre-push, manual]
6351
- repo: https://github.com/pre-commit/mirrors-prettier
64-
rev: v2.6.0
52+
rev: v3.1.0
6553
hooks:
6654
- id: prettier
6755
# - repo: https://github.com/pre-commit/mirrors-mypy

src/stac_api_validator/validations.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -3235,12 +3235,13 @@ def _validate_search_ids_with_ids_no_override(
32353235
errors: Errors,
32363236
r_session: Session,
32373237
) -> None:
3238-
bbox = item["bbox"]
3238+
bbox = item.get("bbox")
32393239
get_params = {
32403240
"ids": item["id"],
32413241
"collections": item["collection"],
3242-
"bbox": f"{bbox[2] + 1},{bbox[3] + 1},{bbox[2] + 2},{bbox[3] + 2}",
32433242
}
3243+
if bbox is not None:
3244+
get_params["bbox"] = f"{bbox[2] + 1},{bbox[3] + 1},{bbox[2] + 2},{bbox[3] + 2}"
32443245

32453246
if Method.GET in methods:
32463247
_, body, _ = retrieve(
@@ -3263,8 +3264,9 @@ def _validate_search_ids_with_ids_no_override(
32633264
post_params = {
32643265
"ids": [item["id"]],
32653266
"collections": [item["collection"]],
3266-
"bbox": [bbox[2] + 1, bbox[3] + 1, bbox[2] + 2, bbox[3] + 2],
32673267
}
3268+
if bbox is not None:
3269+
post_params["bbox"] = [bbox[2] + 1, bbox[3] + 1, bbox[2] + 2, bbox[3] + 2]
32683270

32693271
_, body, _ = retrieve(
32703272
Method.POST,

0 commit comments

Comments
 (0)