Skip to content

Commit

Permalink
Merge pull request #222 from stac-utils/fix_verbose_recursive
Browse files Browse the repository at this point in the history
Move verbose messaging for --recursive
  • Loading branch information
jonhealy1 authored Dec 17, 2022
2 parents f2ee8be + 99cc07e commit 3f5ef40
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:

Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is (loosely) based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [v3.3.1] - 2022-12-16

### Fixed

- Moved --verbose messaging for --recursive as --verbose was printing out the wrong messages https://github.com/stac-utils/stac-validator/pull/222

## [v3.3.0] - 2022-11-28

### Added
Expand Down Expand Up @@ -171,7 +177,8 @@ The format is (loosely) based on [Keep a Changelog](http://keepachangelog.com/)
- With the newest version - 1.0.0-beta.2 - items will run through jsonchema validation before the PySTAC validation. The reason for this is that jsonschema will give more informative error messages. This should be addressed better in the future. This is not the case with the --recursive option as time can be a concern here with larger collections.
- Logging. Various additions were made here depending on the options selected. This was done to help assist people to update their STAC collections.

[Unreleased]: <https://github.com/sparkgeo/stac-validator/compare/v3.3.0..main>
[Unreleased]: <https://github.com/sparkgeo/stac-validator/compare/v3.3.1..main>
[v3.3.1]: <https://github.com/sparkgeo/stac-validator/compare/v3.3.0..v3.3.1>
[v3.3.0]: <https://github.com/sparkgeo/stac-validator/compare/v3.2.0..v3.3.0>
[v3.2.0]: <https://github.com/sparkgeo/stac-validator/compare/v3.1.0..v3.2.0>
[v3.1.0]: <https://github.com/sparkgeo/stac-validator/compare/v3.0.0..v3.1.0>
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import setup

__version__ = "3.3.0"
__version__ = "3.3.1"

with open("README.md", "r") as fh:
long_description = fh.read()
Expand Down
10 changes: 5 additions & 5 deletions stac_validator/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,14 @@ def recursive_validator(self, stac_type: str) -> bool:
self.create_err_msg("JSONSchemaValidationError", err_msg)
)
self.message.append(message)
if self.verbose is True:
click.echo(json.dumps(message, indent=4))
return False

message["valid_stac"] = True
self.message.append(message)
if self.verbose is True:
click.echo(json.dumps(message, indent=4))
self.depth = self.depth + 1
if self.max_depth:
if self.depth >= self.max_depth:
Expand All @@ -243,9 +248,6 @@ def recursive_validator(self, stac_type: str) -> bool:
stac_type = get_stac_type(self.stac_content).lower()

if link["rel"] == "child":

if self.verbose is True:
click.echo(json.dumps(message, indent=4))
self.recursive_validator(stac_type)

if link["rel"] == "item":
Expand All @@ -267,8 +269,6 @@ def recursive_validator(self, stac_type: str) -> bool:
not self.max_depth or self.max_depth < 5
): # TODO this should be configurable, correct?
self.message.append(message)
if self.verbose is True:
click.echo(json.dumps(message, indent=4))
return True

def validate_dict(self, stac_content):
Expand Down
2 changes: 1 addition & 1 deletion tox/Dockerfile-tox
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ COPY . /code/
RUN export LC_ALL=C.UTF-8 && \
export LANG=C.UTF-8 && \
pip3 install . && \
pip3 install tox==3.23.0 && \
pip3 install tox==4.0.11 && \
tox

0 comments on commit 3f5ef40

Please sign in to comment.