You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect to get from this some type of error response that it's not a STAC object -- empty genexp, None, or a documented exception.
Actual:
The attempted read of the non-existant 'links' key in the object dict returns a KeyError.
File "/Users/philvarner/.local/share/virtualenvs/stac-api-validation-suite-tzI1nfla/lib/python3.9/site-packages/pystac/stac_object.py", line 343, in get_stac_objects
link.resolve_stac_object(root=self.get_root())
File "/Users/philvarner/.local/share/virtualenvs/stac-api-validation-suite-tzI1nfla/lib/python3.9/site-packages/pystac/link.py", line 146, in resolve_stac_object
obj = STAC_IO.read_stac_object(target_href, root=root)
File "/Users/philvarner/.local/share/virtualenvs/stac-api-validation-suite-tzI1nfla/lib/python3.9/site-packages/pystac/stac_io.py", line 131, in read_stac_object
return cls.stac_object_from_dict(d, href=uri, root=root)
File "/Users/philvarner/.local/share/virtualenvs/stac-api-validation-suite-tzI1nfla/lib/python3.9/site-packages/pystac/serialization/__init__.py", line 37, in stac_object_from_dict
return Catalog.from_dict(d, href=href, root=root)
File "/Users/philvarner/.local/share/virtualenvs/stac-api-validation-suite-tzI1nfla/lib/python3.9/site-packages/pystac/catalog.py", line 786, in from_dict
catalog_type = CatalogType.determine_type(d)
File "/Users/philvarner/.local/share/virtualenvs/stac-api-validation-suite-tzI1nfla/lib/python3.9/site-packages/pystac/catalog.py", line 60, in determine_type
for link in stac_json['links']:
KeyError: 'links'
The text was updated successfully, but these errors were encountered:
Thanks for reporting this @philvarner. It looks like this is coming via pystac-client, which is pinned to 0.5.6, but I've verified that it's also an issue in the latest version (v1.0.0-beta.2).
I would expect to get from this some type of error response that it's not a STAC object -- empty genexp, None, or a documented exception.
Given that this method is called get_stac_objects my vote would be for raising an exception in this case.
It looks like the root cause is that in pystac.serialization.identify_stac_object any JSON objects that don't have a type field and don't match conditions for any other STAC object are assumed to be Catalogs here. We should probably implement something closer to this suggestion by checking for stac_version to see if it's a Catalog and otherwise raising an exception (since we don't claim to support STAC <v0.6 this should work fine).
It seems like having pystac.serialization.identify_stac_object raise a STACTypeException in this case would be appropriate.
We should fix this for the latest version, but also patch the other supported release lines.
This code attempts to retrieve the root
service-desc
link as required by OAFeat. This file is OpenAPI rather than STAC.Expected:
I would expect to get from this some type of error response that it's not a STAC object -- empty genexp, None, or a documented exception.
Actual:
The attempted read of the non-existant 'links' key in the object dict returns a KeyError.
The text was updated successfully, but these errors were encountered: