Skip to content

add Fields Extensions validation support #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ repos:
rev: v2.6.0
hooks:
- id: prettier
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.981
hooks:
- id: mypy
exclude: '(test_.*|noxfile)\.py'
additional_dependencies:
["types-requests", "types-click", "types-PyYAML"]
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.981
# hooks:
# - id: mypy
# exclude: '(test_.*|noxfile)\.py'
# additional_dependencies:
# ["types-requests", "types-click", "types-PyYAML"]
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] - TBD

### Added

- Added support for Fields Extension validation of Item Search with `--conformance item-search#fields` and `--fields-nested-property properties.eo:cloud_cover`
- Add parameter set `--validate-pagination/--no-validate-pagination` to conditionally run the pagination tests, which may take a while to run.

## [0.5.0] - 2023-02-21

### Added
Expand Down
28 changes: 16 additions & 12 deletions COMPLIANCE_REPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Date: 19-Jan-2022

Output:

```
```text
Validating http://0.0.0.0:8081
STAC API - Core conformance class found.
STAC API - Features conformance class found.
Expand All @@ -44,7 +44,7 @@ Date: 19-Jan-2022

Output:

```
```text
Validating http://0.0.0.0:8082
STAC API - Core conformance class found.
STAC API - Features conformance class found.
Expand Down Expand Up @@ -72,7 +72,7 @@ Date: 17-Mar-2022

Output:

```
```text
Validating http://localhost:8083
STAC API - Core conformance class found.
STAC API - Features conformance class found.
Expand All @@ -99,7 +99,7 @@ Date: 17-Mar-2022

Output:

```
```text
Validating http://localhost:3000
STAC API - Core conformance class found.
STAC API - Features conformance class found.
Expand Down Expand Up @@ -139,12 +139,14 @@ Date: 16-Nov-2022

Output:

```
```text
$ poetry run stac-api-validator --root-url https://planetarycomputer.microsoft.com/api/stac/v1 \
--conformance features \
--conformance item-search \
--conformance filter \
--conformance item-search#fields \
--collection sentinel-2-l2a \
--fields-nested-property properties.eo:cloud_cover \
--geometry '{"type": "Polygon", "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}'
INFO:stac_api_validator.validations:Validating STAC API - Core conformance class.
INFO:stac_api_validator.validations:Skipping STAC API - Browseable conformance class.
Expand Down Expand Up @@ -204,7 +206,7 @@ Date: 25-Oct-2022

Output

```
```text
$ poetry run stac-api-validator --root-url https://tamn.snapplanet.io \
--conformance features \
--conformance item-search \
Expand Down Expand Up @@ -259,7 +261,7 @@ Date: 31-Oct-2022

Output

```
```text
$ poetry run stac-api-validator --root-url https://api.radiant.earth/mlhub/v1 \
--conformance core --conformance features --conformance item-search \
--auth-query-parameter 'key=xxx' \
Expand All @@ -276,7 +278,7 @@ Date: 16-Nov-2022

Output

```
```text
$ poetry run stac-api-validator --root-url https://services.sentinel-hub.com/api/v1/catalog/1.0.0/ --conformance core
INFO:stac_api_validator.validations:Validating STAC API - Core conformance class.
INFO:stac_api_validator.validations:Skipping STAC API - Browseable conformance class.
Expand All @@ -301,11 +303,13 @@ Date: 16-Nov-2022

Output:

```
```text
$ poetry run stac-api-validator --root-url https://earth-search.aws.element84.com/v1 \
--conformance features \
--conformance item-search \
--conformance item-search#fields \
--collection sentinel-2-l2a \
--fields-nested-property properties.eo:cloud_cover \
--geometry '{"type": "Polygon", "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}'
INFO:stac_api_validator.validations:Validating STAC API - Core conformance class.
INFO:stac_api_validator.validations:Skipping STAC API - Browseable conformance class.
Expand Down Expand Up @@ -341,7 +345,7 @@ Notes: Features is supported, but not advertised in conformsTo

Output:

```
```text
$ poetry run stac-api-validator --root-url https://cmr.earthdata.nasa.gov/stac/USGS_EROS --conformance item-search --collection Landsat1-5_MSS_C1.v1 --geometry '{"type": "Polygon", "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}'

INFO:stac_api_validator.validations:Validating STAC API - Core conformance class.
Expand Down Expand Up @@ -413,7 +417,7 @@ URL: <https://landsatlook.usgs.gov/stac-server>

Date: 25-Oct-2022

```
```text
$ poetry run stac-api-validator --root-url https://landsatlook.usgs.gov/stac-server --conformance features --conformance item-search \
∙ --collection landsat-c2l2-sr --geometry '{"type": "Polygon", "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}'
INFO:stac_api_validator.validations:Validating STAC API - Core conformance class.
Expand All @@ -439,7 +443,7 @@ URL: <https://franklin.nasa-hsi.azavea.com>

Date: 19-Jan-2022

```
```text
STAC API - Core conformance class found.
STAC API - Features conformance class found.
STAC API - Item Search conformance class found.
Expand Down
13 changes: 13 additions & 0 deletions src/stac_api_validator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@
"--auth-query-parameter",
help="Query parameter key and value to pass for authorization, e.g., 'key=xyz'.",
)
@click.option(
"--fields-nested-property",
help="Fields Extension: name of a field in Item Properties, e.g. 'properties.eo:cloud_cover'",
)
@click.option(
"--validate-pagination/--no-validate-pagination",
default=False,
help="Validate pagination behavior (can take a long time to run)",
)
def main(
log_level: str,
root_url: str,
Expand All @@ -72,6 +81,8 @@ def main(
geometry: Optional[str],
auth_bearer_token: Optional[str] = None,
auth_query_parameter: Optional[str] = None,
fields_nested_property: Optional[str] = None,
validate_pagination: bool = False,
) -> int:
"""STAC API Validator."""
logging.basicConfig(stream=sys.stdout, level=log_level)
Expand All @@ -84,6 +95,8 @@ def main(
geometry=geometry,
auth_bearer_token=auth_bearer_token,
auth_query_parameter=auth_query_parameter,
fields_nested_property=fields_nested_property,
validate_pagination=validate_pagination,
)
except Exception as e:
click.secho(
Expand Down
Loading