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):
includesstac-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 inincludeorexclude, the extension does not specify whether that field should be present on the response items (though it does provide guidance). Currently,linksis included by default, even if it is not present in theincludelist. This PR changes that behavior to excludelinksby default if there is anincludelist.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
includeorexcludewas set. pgstac was a little trickier, because it doesn't use thedefault_includeslist.I did modify one existing test --
test_app_fields_extensionin the sqlalchemy tests was assuming fields would be stripped just by providing acollectionsparameter to the query, which I think is incorrect -- I added an explicitincludefield to the test.PR Checklist:
pre-commit run --all-files)make test)make docs)