Assets keep their own stac_extensions#1256
Assets keep their own stac_extensions#1256constantinius wants to merge 2 commits intostac-utils:mainfrom
stac_extensions#1256Conversation
so that they can be extended without being added to an Item. Deprecating validate_owner_has_extension Switching from validate_owner_has_extension to ensure_has_extension in extensions dealing with assets Extracting a final list of assets in the `to_dict` function for Items and Collections.
gadomski
left a comment
There was a problem hiding this comment.
The idea seems reasonable to me, though my inclination is to make the attribute private on an asset, e.g.:
class Asset:
_stac_extensions: List[str]
...It's not part of the spec, it's a PySTAC implementation detail, so users shouldn't be touching it themselves.
|
765a05f does that. This makes the extension handling more complex now, though, as we have to introduce a couple of new code paths as we cannot simply treat assets as objects having a What would you say? |
You're right, that is pretty awkward. Maybe |
Related Issue(s):
Description:
This PR aims to make
Assetobjects more independent, i.e allow to extend them, even if they are not yet inserted into anItem/Collection.This is achieved by letting assets keep their own
stac_extensionslist, which is merged with theItems/Collectionsstac_extensionin the respectiveto_dictfunctionOther relevant changes:
validate_owner_has_extensionvalidate_owner_has_extensiontoensure_has_extensionin extensions dealing with assetsPR Checklist:
pre-commithooks pass locallyscripts/test)