Validate STAC links for single dict
m-mohr opened this issue · comments
As far as I understand, validate_all implicitly validates whether the STAC links (item, child) are valid (i.e. the href exists).
It would be great if this small feature would also be available (via a flag/parameter) in the validation for a single object/dict.
Hey @m-mohr,
Does the recursive
parameter in validate_all address your issue?
For example:
import pystac
catalog_file = r"https://raw.githubusercontent.com/stac-utils/pystac/main/tests/data-files/catalogs/label_catalog-v0.8.1/catalog.json"
catalog = pystac.Catalog.from_file(catalog_file)
catalog.validate_all()
>>> 62
catalog.validate_all(recursive=False)
>>> 0
I don't think so. The question is not related to recursion, more to be able to check whether link hrefs actually exist.
I don't think so. The question is not related to recursion, more to be able to check whether link hrefs actually exist.
In Catalog.validate_all
, all item and child links are checked and validated regardless of the value of recursive
:
Lines 1058 to 1069 in 9c323c4
So Catalog.validate_all(recursive=False)
and Catalog.validate_all(recursive=False)
will check all STAC links on the Catalog/Collection without recursing into the children and validating those links.
But the issue is about validate, not validate_all.
But the issue is about validate, not validate_all.
😕 I think we currently allow all the possible cases via validate
and validate_all
:
Catalog.validate()
does not read or validate linksCatalog.validate_all(recursive=False)
reads and validates links, but does not do the same for childrenCatalog.validate_all(recursive=True)
reads and validates links, and does the same for children
Is there another behavior that I'm missing?
Oh, I see. You were saying I should use validate_all(recursive=False) instead of validate. Will try...