From 501b3fdb92a619222be9e3a1cc5d445519c56b48 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 6 May 2024 10:45:55 +0200 Subject: [PATCH] move response class in route definitions --- CHANGES.md | 1 + .../extensions/core/filter/filter.py | 26 ++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f12cda471..44cbb2df8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ * Fix response model validation ([#625](https://github.com/stac-utils/stac-fastapi/pull/625)) * Use status code 201 for Item/Collection creation ([#625](https://github.com/stac-utils/stac-fastapi/pull/625)) * Replace Black with Ruff Format ([#625](https://github.com/stac-utils/stac-fastapi/pull/625)) +* add `response_class` in the route definitions for `FilterExtension` ## [2.5.5.post1] - 2024-04-25 diff --git a/stac_fastapi/extensions/stac_fastapi/extensions/core/filter/filter.py b/stac_fastapi/extensions/stac_fastapi/extensions/core/filter/filter.py index 2f875907a..0ebc3f9c4 100644 --- a/stac_fastapi/extensions/stac_fastapi/extensions/core/filter/filter.py +++ b/stac_fastapi/extensions/stac_fastapi/extensions/core/filter/filter.py @@ -97,16 +97,30 @@ def register(self, app: FastAPI) -> None: name="Queryables", path="/queryables", methods=["GET"], - endpoint=create_async_endpoint( - self.client.get_queryables, EmptyRequest, self.response_class - ), + responses={ + 200: { + "content": { + "application/schema+json": {}, + }, + # TODO: add output model in stac-pydantic + }, + }, + response_class=self.response_class, + endpoint=create_async_endpoint(self.client.get_queryables, EmptyRequest), ) self.router.add_api_route( name="Collection Queryables", path="/collections/{collection_id}/queryables", methods=["GET"], - endpoint=create_async_endpoint( - self.client.get_queryables, CollectionUri, self.response_class - ), + responses={ + 200: { + "content": { + "application/schema+json": {}, + }, + # TODO: add output model in stac-pydantic + }, + }, + response_class=self.response_class, + endpoint=create_async_endpoint(self.client.get_queryables, CollectionUri), ) app.include_router(self.router, tags=["Filter Extension"])