Skip to content

Commit

Permalink
Merge pull request #197 from gadomski/recursive-fixup
Browse files Browse the repository at this point in the history
Recursive fixup
  • Loading branch information
jonhealy1 authored Mar 11, 2022
2 parents 7e15e17 + 70471e9 commit d8acc23
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion stac_validator/stac_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion stac_validator/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions tests/test_recursion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d8acc23

Please sign in to comment.