Skip to content
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

Configurable request models #602

Closed
TomAugspurger opened this issue Sep 14, 2023 · 1 comment · Fixed by #718
Closed

Configurable request models #602

TomAugspurger opened this issue Sep 14, 2023 · 1 comment · Fixed by #718
Labels
enhancement New feature or request

Comments

@TomAugspurger
Copy link

I'd like to add an additional parameter to the /collections/collection/items/item endpoint. IIUC, doing that currently requires something like this:

    def register_get_item(self):
        """Register get item endpoint (GET /collections/{collection_id}/items/{item_id}).

        Returns:
            None
        """
        # This matches the implementation in stac-fastapi, aside from
        # swapping the request_model passed to create_async_endpoint.
        self.router.add_api_route(
            name="Get Item",
            path="/collections/{collection_id}/items/{item_id}",
            response_model=Item if self.settings.enable_response_models else None,
            response_class=GeoJSONResponse,
            response_model_exclude_unset=True,
            response_model_exclude_none=True,
            methods=["GET"],
            endpoint=create_async_endpoint(
                self.client.get_item,
                MyItemUri,  # <----- only change, to swap the request model
                GeoJSONResponse
            ),
        )

I see that 33611f7 added some class attributes like search_get_request_model. Any objections to expanding that to other endpoints?

@gadomski
Copy link
Member

Any objections to expanding that to other endpoints?

Not from my side!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants