-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align fields extension behavior with extension suggestions #527
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):
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
)