Skip to content

Fields extension: specifying both exclude and include for the same field does not result in expected behavior #362

@mcucchi9

Description

@mcucchi9

Tag: 6.2.1

The STAC API specification for the Fields extension states that (point 6 here):

If the same field is present in both include and exclude, it should be included.

On the contrary, performing a POST /search request to an instance of the stac-fastapi-pgstac API with the following payload

{
    "fields": {
        "exclude": ["properties.datetime"],
        "include": ["properties.datetime"]
    }
}

results in a FeatureCollection in which each Feature only have the fields id, collection and links.

Digging into the code, I can see this behavior is probably due to the logic in the filter_fields function of stac_fastapi/pgstac/utils.py, in which the exclude and include operations are applied sequentially and in this order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions