Align fields extension behavior with extension suggestions #527
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issue(s):
includes
stac-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:
include
fields are merged with the default include setfields
attribute will return the default include setstac_version
in the default includes to ensure valid STAC itemsstac_version
in include recommendations stac-api-extensions/fields#4)collection
andstac_extensions
, as (in this author's opinion) these are valuable and cheapThe recommendations are encapsulated in a
into_recommended
method, 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
)