Skip to content

Browseable validation throws KeyError exception #527

@LeoBreebaart

Description

@LeoBreebaart

I get the following exception trace when trying to run the validator (v0.6.2) with --conformance browseable:

INFO:stac_api_validator.validations:Validating STAC API - Browseable conformance class.
Failed.
Error http://127.0.0.1:8000/api/zipped: <class 'AttributeError'> 'Item' object has no attribute 'collection' Traceback (most recent call last):
  File "/Users/leo/.pyenv/versions/test/lib/python3.10/site-packages/stac_api_validator/__main__.py", line 163, in main
    (warnings, errors) = validate_api(
  File "/Users/leo/.pyenv/versions/test/lib/python3.10/site-packages/stac_api_validator/validations.py", line 579, in validate_api
    validate_browseable(landing_page_body, errors, warnings, r_session)
  File "/Users/leo/.pyenv/versions/test/lib/python3.10/site-packages/stac_api_validator/validations.py", line 849, in validate_browseable
    params={"ids": item.id, "collections": item.collection},
AttributeError: 'Item' object has no attribute 'collection'

The item in Line 849 of validations.py is the result from a call to pystac's (v1.10.1) Catalog.from_dict(root_body).get_all_items(). However:

  1. get_all_items() is now deprecated according to https://pystac.readthedocs.io/en/stable/_modules/pystac/catalog.html#Catalog.get_all_items
  2. I can verify separately that items returned from that call indeed do not contain a collection field, just a collection_id field.

If I patch line 849 to use collection_id my API validates perfectly fine.

Is this indeed an issue in the validator, or am I missing something?

Regards,

-- Leo

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions