Skip to content

Conversation

@vincentsarago
Copy link
Member

closes #157

This PR does:

  • add filter extension support for Item Collection endpoint
  • refactor the exertions map to better define extensions for each endpoints / application

@vincentsarago vincentsarago requested a review from hrodmn January 22, 2025 15:28
itm_col_extensions_map = {
"filter": FilterExtension(client=FiltersClient()),
"pagination": TokenPaginationExtension(),
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first I tried to removed the duplication of the class init (e.g we do twice FilterExtension(client=FiltersClient())), but I couldn't find a nice a clear way

# Extensions
token: Optional[str] = None,
filter_expr: Optional[str] = None,
filter_lang: Optional[str] = None,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory we could add sort, fields and more but this is not officially supported by the stac spec

Copy link
Contributor

@m-mohr m-mohr Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhhh this wasn't in stac-fastapi so I assume it wasn't in the spec 🤦

thanks @m-mohr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this btw. Was just debugging why STAC Browser search queries weren't returning proper results and it seemed that there was a bug, but obviously it wasn't implemented. So good timing. I'd think supporting fields, sort and filter on the .../items endpoint would be a very welcome addition.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So good timing. I'd think supporting fields, sort and filter on the .../items endpoint would be a very welcome addition.

I'll try my best to add those but we might have issues downstream for add the conformance classes in the application which will require a new stac-fastapi release

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks. I'm fine either way as long as the conformance classes are set correctly ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-mohr maybe you could help, there something I don't get about the conformance classes. if we have https://api.stacspec.org/v1.0.0/ogcapi-features#sort in the conformances, that doesn't mean the /collections/{collectionId}/items would have the sort parameter. It could mean that the /search endpoint support it. How do you deal with this?

Copy link
Contributor

@m-mohr m-mohr Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vincentsarago For /search the conformance class is https://api.stacspec.org/v1.0.0/item-search#sort. For .../items it is https://api.stacspec.org/v1.0.0/ogcapi-features#sort though. So you can distinguish which endpoint supports sort. Similarly for filter etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See
grafik

Copy link
Collaborator

@hrodmn hrodmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for separating the different types of extensions! My main question is about the change to the list provided to the extensions argument in the StacApi definition. Does that have any downstream consequences? It would be great if you could update conftest.py with the same structure so we can be sure that setup is getting tested!

@vincentsarago
Copy link
Member Author

Thanks for separating the different types of extensions! My main question is about the change to the list provided to the extensions argument in the StacApi definition. Does that have any downstream consequences?

@hrodmn This PR shouldn't change what is provided to the application.

It would be great if you could update conftest.py with the same structure so we can be sure that setup is getting tested!

👍

@vincentsarago vincentsarago merged commit df4c12a into main Jan 22, 2025
7 checks passed
@vincentsarago vincentsarago deleted the feature/refactor-extension-maps branch January 22, 2025 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enable the filter extension for collection_items endpoint

3 participants