This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes: - A simple script to validate all collection files - A new CI/CD step to run the validation script There wasn't an obvious place to add the validation to a lambda test, so I make it its own thing.
- Loading branch information
Showing
8 changed files
with
67 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,10 @@ | |
"spatial":{ | ||
"bbox":[ | ||
[ | ||
"-180", | ||
"90", | ||
"-90", | ||
"180" | ||
-180, | ||
90, | ||
-90, | ||
180 | ||
] | ||
] | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,10 @@ | |
"spatial":{ | ||
"bbox":[ | ||
[ | ||
"-180", | ||
"90", | ||
"-90", | ||
"180" | ||
-180, | ||
90, | ||
-90, | ||
180 | ||
] | ||
] | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,10 @@ | |
"spatial":{ | ||
"bbox":[ | ||
[ | ||
"-180", | ||
"90", | ||
"-90", | ||
"180" | ||
-180, | ||
90, | ||
-90, | ||
180 | ||
] | ||
] | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import sys | ||
from pathlib import Path | ||
|
||
from pystac import Collection | ||
from pystac.errors import STACValidationError | ||
|
||
root = Path(__file__).parents[1] | ||
collections = root / "data" / "collections" | ||
|
||
errors = False | ||
for path in collections.glob("*.json"): | ||
try: | ||
collection = Collection.from_file(str(path)) | ||
except Exception as err: | ||
errors = True | ||
print( | ||
f"ERROR [{path.name}]: could not read collection because {type(err)}: {err}" | ||
) | ||
try: | ||
collection.validate() | ||
except STACValidationError as err: | ||
errors = True | ||
print( | ||
f"VALIDATION [{path.name}]: {collection.id} is invalid because {err.source}" | ||
) | ||
|
||
if errors: | ||
sys.exit(1) |