Skip to content

Commit 4e93657

Browse files
authored
Merge branch 'main' into reverse-coords
2 parents c980908 + 3628356 commit 4e93657

File tree

11 files changed

+542
-38
lines changed

11 files changed

+542
-38
lines changed

.github/workflows/test-runner.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v3
2020

21-
- name: Set up Python 3.10
21+
- name: Set up Python 3.12
2222
uses: actions/setup-python@v4
2323
with:
24-
python-version: "3.10"
24+
python-version: "3.12"
2525

2626
- name: Install dependencies
2727
run: |
@@ -41,7 +41,7 @@ jobs:
4141
runs-on: ubuntu-latest
4242
strategy:
4343
matrix:
44-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
44+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
4545

4646
steps:
4747
- uses: actions/checkout@v3

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,36 @@ The format is (loosely) based on [Keep a Changelog](http://keepachangelog.com/)
88

99
### Added
1010

11+
- Added validation for bounding boxes that cross the antimeridian (180°/-180° longitude) ([#121](https://github.com/stac-utils/stac-check/pull/121))
12+
- Checks that bbox coordinates follow the GeoJSON specification for antimeridian crossing
13+
- Detects and reports cases where a bbox incorrectly "belts the globe" instead of properly crossing the antimeridian
14+
- Provides clear error messages to help users fix incorrectly formatted bboxes
1115
- Added sponsors and supporters section with logos ([#122](https://github.com/stac-utils/stac-check/pull/122))
16+
- Added check to verify that bbox matches item's polygon geometry ([#123](https://github.com/stac-utils/stac-check/pull/123))
1217
- Added configuration documentation to README ([#124](https://github.com/stac-utils/stac-check/pull/124))
1318
- Added validation for geometry coordinates order to detect potentially reversed lat/lon coordinates ([#125](https://github.com/stac-utils/stac-check/pull/125))
1419
- Checks that coordinates follow the GeoJSON specification with [longitude, latitude] order
1520
- Uses heuristics to identify coordinates that may be reversed or contain errors
1621
- Provides nuanced error messages acknowledging the uncertainty in coordinate validation
22+
- Added `--pydantic` option for validating STAC objects using stac-pydantic models, providing enhanced type checking and validation ([#126](https://github.com/stac-utils/stac-check/pull/126))
23+
24+
### Enhanced
25+
26+
- Improved bbox validation output to show detailed information about mismatches between bbox and geometry bounds, including which specific coordinates differ and by how much ([#126](https://github.com/stac-utils/stac-check/pull/126))
27+
28+
### Fixed
29+
30+
- Fixed collection summaries check incorrectly showing messages for Item assets ([#121](https://github.com/stac-utils/stac-check/pull/127))
1731

1832
### Updated
1933

2034
- Improved README with table of contents, better formatting, stac-check logo, and enhanced documentation ([#122](https://github.com/stac-utils/stac-check/pull/122))
2135
- Enhanced Contributing guidelines with step-by-step instructions ([#122](https://github.com/stac-utils/stac-check/pull/122))
2236

37+
### Removed
38+
39+
- Support for Python 3.8 ([#121](https://github.com/stac-utils/stac-check/pull/121))
40+
2341
## [v1.6.0] - 2025-03-14
2442

2543
### Added

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Options:
8686
(enabled by default).
8787
--header KEY VALUE HTTP header to include in the requests. Can be used
8888
multiple times.
89+
--pydantic Use stac-pydantic for enhanced validation with Pydantic models.
8990
--help Show this message and exit.
9091
```
9192

@@ -130,6 +131,8 @@ linting:
130131
links_self: true
131132
# check if geometry coordinates are potentially ordered incorrectly (longitude, latitude)
132133
geometry_coordinates_order: true
134+
# check if a bbox that crosses the antimeridian is correctly formatted
135+
check_bbox_antimeridian: true
133136

134137
settings:
135138
# Number of links before the bloated links warning is shown

sample_files/1.0.0/bad-item.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-122.59750209,
99
37.48803556,
1010
-122.2880486,
11-
37.613537207
11+
37.613531207
1212
],
1313
"geometry": {
1414
"type": "Polygon",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"stac_version": "1.0.0",
3+
"type": "Feature",
4+
"id": "invalid-antimeridian-bbox",
5+
"bbox": [-170, -10, 170, 10],
6+
"geometry": {
7+
"type": "Polygon",
8+
"coordinates": [
9+
[
10+
[-170, -10],
11+
[170, -10],
12+
[170, 10],
13+
[-170, 10],
14+
[-170, -10]
15+
]
16+
]
17+
},
18+
"properties": {
19+
"datetime": "2023-01-01T00:00:00Z"
20+
},
21+
"links": [],
22+
"assets": {}
23+
}

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from setuptools import find_packages, setup
55

6-
__version__ = "1.6.0"
6+
__version__ = "1.7.0"
77

88
with open("README.md", "r") as fh:
99
long_description = fh.read()
@@ -20,7 +20,7 @@
2020
"requests>=2.32.3",
2121
"jsonschema>=4.23.0",
2222
"click>=8.1.8",
23-
"stac-validator>=3.6.0",
23+
"stac-validator[pydantic]>=3.7.0",
2424
"PyYAML",
2525
"python-dotenv",
2626
],
@@ -37,6 +37,6 @@
3737
license="MIT",
3838
long_description=long_description,
3939
long_description_content_type="text/markdown",
40-
python_requires=">=3.8",
40+
python_requires=">=3.9",
4141
tests_require=["pytest"],
4242
)

stac_check/cli.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ def intro_message(linter: Linter) -> None:
9191
f"Validator: stac-validator {linter.validator_version}", bg="blue", fg="white"
9292
)
9393

94+
# Always show validation method
95+
validation_method = (
96+
"Pydantic" if hasattr(linter, "pydantic") and linter.pydantic else "JSONSchema"
97+
)
98+
click.secho()
99+
click.secho(f"Validation method: {validation_method}", bg="yellow", fg="black")
100+
94101
click.secho()
95102

96103

@@ -111,7 +118,17 @@ def cli_message(linter: Linter) -> None:
111118

112119
""" schemas validated for core object """
113120
click.secho()
114-
if len(linter.schema) > 0:
121+
122+
# Determine if we're using Pydantic validation
123+
using_pydantic = hasattr(linter, "pydantic") and linter.pydantic
124+
125+
# For Pydantic validation, always show the appropriate schema model
126+
if using_pydantic:
127+
click.secho("Schemas validated: ", fg="blue")
128+
asset_type = linter.asset_type.capitalize() if linter.asset_type else "Item"
129+
click.secho(f" stac-pydantic {asset_type} model")
130+
# For JSONSchema validation or when schemas are available
131+
elif len(linter.schema) > 0:
115132
click.secho("Schemas validated: ", fg="blue")
116133
for schema in linter.schema:
117134
click.secho(f" {schema}")
@@ -194,10 +211,15 @@ def cli_message(linter: Linter) -> None:
194211
multiple=True,
195212
help="HTTP header to include in the requests. Can be used multiple times.",
196213
)
214+
@click.option(
215+
"--pydantic",
216+
is_flag=True,
217+
help="Use stac-pydantic for enhanced validation with Pydantic models.",
218+
)
197219
@click.command()
198220
@click.argument("file")
199221
@click.version_option(version=importlib.metadata.distribution("stac-check").version)
200-
def main(file, recursive, max_depth, assets, links, no_assets_urls, header):
222+
def main(file, recursive, max_depth, assets, links, no_assets_urls, header, pydantic):
201223
linter = Linter(
202224
file,
203225
assets=assets,
@@ -206,6 +228,7 @@ def main(file, recursive, max_depth, assets, links, no_assets_urls, header):
206228
max_depth=max_depth,
207229
assets_open_urls=not no_assets_urls,
208230
headers=dict(header),
231+
pydantic=pydantic,
209232
)
210233
intro_message(linter)
211234
if recursive > 0:

0 commit comments

Comments
 (0)