From 2c5dc81a4f4550b913c8baadd9ed0cff6e2e308f Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Fri, 11 Mar 2022 07:19:42 -0700 Subject: [PATCH 1/3] fix: append messages even if max_depth isn't set Includes unit test. --- stac_validator/validate.py | 2 +- tests/test_recursion.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/stac_validator/validate.py b/stac_validator/validate.py index e5deda2c..2c97d7b9 100644 --- a/stac_validator/validate.py +++ b/stac_validator/validate.py @@ -248,7 +248,7 @@ def recursive_validator(self, stac_type: str): if self.log != "": self.message.append(message) if ( - self.max_depth and self.max_depth < 5 + not self.max_depth or self.max_depth < 5 ): # TODO this should be configurable, correct? self.message.append(message) if self.verbose is True: diff --git a/tests/test_recursion.py b/tests/test_recursion.py index ebb2a825..7de941d9 100644 --- a/tests/test_recursion.py +++ b/tests/test_recursion.py @@ -297,3 +297,10 @@ def test_recursion_collection_local_2_v1rc2(): "valid_stac": True, }, ] + + +def test_recursion_without_max_depth(): + stac_file = "tests/test_data/v100/catalog.json" + stac = stac_validator.StacValidate(stac_file, recursive=True) + stac.run() + assert len(stac.message) == 6 From 2cd22aaef152918827768bcd955da27899e6f505 Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Fri, 11 Mar 2022 07:21:14 -0700 Subject: [PATCH 2/3] docs: add note to max-depth re: full recursion --- stac_validator/stac_validator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stac_validator/stac_validator.py b/stac_validator/stac_validator.py index 3364c29d..1ced1478 100644 --- a/stac_validator/stac_validator.py +++ b/stac_validator/stac_validator.py @@ -45,7 +45,7 @@ "--max-depth", "-m", type=int, - help="Maximum depth to traverse when recursing. Ignored if `recursive == False`.", + help="Maximum depth to traverse when recursing. Omit this argument to get full recursion. Ignored if `recursive == False`.", ) @click.option( "-v", "--verbose", is_flag=True, help="Enables verbose output for recursive mode." From 8ae536f9dd26f4a2eaf2bc3a948dc4c171637c09 Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Fri, 11 Mar 2022 07:22:29 -0700 Subject: [PATCH 3/3] chore: update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6126bb40..fa9b7e21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ 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/). +## [Unreleased] + +### Added + +- A note about full recursion to the `--max-depth` help text + +### Fixed + +- Item messages are now included even if `max_depth is None` + ## [v2.5.0] - 2022-03-10 ### Changed