Remove links from default include list #524
Closed
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 #527. We should merge one and close the other.
Description:
The fields extension is used to include/exclude fields on items returned by
/search
(and/collections/{cid}/items
). If a field is not present ininclude
orexclude
, the extension does not specify whether that field should be present on the response items (though it does provide guidance). Currently,links
is included by default, even if it is not present in theinclude
list. This PR changes that behavior to excludelinks
by default if there is aninclude
list.sqlalchemy uses
FieldsExtension.default_includes
, so its fix was pretty easy-- I did have to add an explicit include+exclude check to the search function to ensure the fields extension was applied only if either
include
orexclude
was set. pgstac was a little trickier, because it doesn't use thedefault_includes
list.I did modify one existing test --
test_app_fields_extension
in the sqlalchemy tests was assuming fields would be stripped just by providing acollections
parameter to the query, which I think is incorrect -- I added an explicitinclude
field to the test.PR Checklist:
pre-commit run --all-files
)make test
)make docs
)