Align fields extension behavior with extension suggestions#527
Align fields extension behavior with extension suggestions#527gadomski wants to merge 4 commits into
Conversation
This allows detection of whether `fields` was present in the request at all.
We are now following the recommendations in https://github.com/stac-api-extensions/fields#includeexclude-semantics
|
I understand the rationale for making it easy to always return a valid STAC Item despite what you put in In that case, I understand I shouldn't try to parse the results as Items. I also think it's a bit cumbersome to have to copy over fields I would now see in my results to |
|
Additionally, the Field Extension explicitly says that it makes returning invalid Items legal, so it's a desire to have valid items returned rather than a requirement. |
|
Converting to draft until stac-api-extensions/fields#5 lands. Once it does, I think we'll use #524 as the base solution, but there could be ideas from this PR that would be useful to port over. |
|
Closing as blocked by stac-api-extensions/fields#5. |
Related Issue(s):
includesstac-fastapi-pgstac#27This is one of two PRs that would fix stac-utils/stac-fastapi-pgstac#27; the other is #524. We should merge one and close the other (should happen automatically thanks to closing keywords).
Description:
This PR updates both backends to (mostly) follow the recommended field extension semantics, as laid out in https://github.com/stac-api-extensions/fields#includeexclude-semantics. In particular:
includefields are merged with the default include setfieldsattribute will return the default include setstac_versionin the default includes to ensure valid STAC itemsstac_versionin include recommendations stac-api-extensions/fields#4)collectionandstac_extensions, as (in this author's opinion) these are valuable and cheapThe recommendations are encapsulated in a
into_recommendedmethod, where the set operations are performed: https://github.com/stac-utils/stac-fastapi/compare/issues/395-align-include-with-suggestions?expand=1#diff-b9d01a5a656ba2bdee8dd6eb5462bf1b1602b01bceaafb431cff8c38969815d5R61-R76.I've also updated the fields extension default to be
None, which allows for detection of an empty fields attribute (e.g.?fields=). This was required to enable item 1 in https://github.com/stac-api-extensions/fields#includeexclude-semantics.PR Checklist:
pre-commit run --all-files)make test)make docs)