From 6fe467098b9d9a6f95a373902dd382dd15fdb63b Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Thu, 6 Jul 2023 11:50:13 +0200 Subject: [PATCH 1/4] Adding queryables link to landing page --- stac_fastapi/types/stac_fastapi/types/core.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stac_fastapi/types/stac_fastapi/types/core.py b/stac_fastapi/types/stac_fastapi/types/core.py index 5798de968..74a8d9788 100644 --- a/stac_fastapi/types/stac_fastapi/types/core.py +++ b/stac_fastapi/types/stac_fastapi/types/core.py @@ -306,6 +306,13 @@ def _landing_page( "href": urljoin(base_url, "search"), "method": "POST", }, + { + "rel": Relations.queryables.value, + "type": MimeTypes.schemajson, + "title": "Queryables", + "href": urljoin(base_url, "queryables"), + "method": "GET", + }, ], stac_extensions=extension_schemas, ) From 9a08dcc7c80bcb66ad7732b145ec5f67d18f8a5e Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Thu, 6 Jul 2023 11:55:09 +0200 Subject: [PATCH 2/4] Adding info to changelog --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index bd3ecd37b..80225b63c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,8 @@ ## [Unreleased] +* Add `/queryables` link to the landing page ([#587](https://github.com/stac-utils/stac-fastapi/pull/587)) + ## [2.4.8] - 2023-06-07 ### Changed From 7c8c330ad5493aa8dd061264551710c1107c3257 Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Thu, 6 Jul 2023 13:12:56 +0200 Subject: [PATCH 3/4] Fixing schemajson -> jsonschema --- stac_fastapi/types/stac_fastapi/types/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stac_fastapi/types/stac_fastapi/types/core.py b/stac_fastapi/types/stac_fastapi/types/core.py index 74a8d9788..ac99fc4f3 100644 --- a/stac_fastapi/types/stac_fastapi/types/core.py +++ b/stac_fastapi/types/stac_fastapi/types/core.py @@ -308,7 +308,7 @@ def _landing_page( }, { "rel": Relations.queryables.value, - "type": MimeTypes.schemajson, + "type": MimeTypes.jsonschema, "title": "Queryables", "href": urljoin(base_url, "queryables"), "method": "GET", From 05940812bf12e9ba62fc13d86b10acbf3c5efe0a Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Wed, 10 Apr 2024 10:05:14 +0200 Subject: [PATCH 4/4] use `extension_is_enabled` --- stac_fastapi/types/stac_fastapi/types/core.py | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/stac_fastapi/types/stac_fastapi/types/core.py b/stac_fastapi/types/stac_fastapi/types/core.py index 9fe7df238..a704ae49b 100644 --- a/stac_fastapi/types/stac_fastapi/types/core.py +++ b/stac_fastapi/types/stac_fastapi/types/core.py @@ -308,13 +308,6 @@ def _landing_page( "href": urljoin(base_url, "search"), "method": "POST", }, - { - "rel": Relations.queryables.value, - "type": MimeTypes.jsonschema, - "title": "Queryables", - "href": urljoin(base_url, "queryables"), - "method": "GET", - }, ], stac_extensions=extension_schemas, ) @@ -376,6 +369,18 @@ def landing_page(self, **kwargs) -> stac_types.LandingPage: extension_schemas=[], ) + # Add Queryables link + if self.extension_is_enabled("FilterExtension"): + landing_page["links"].append( + { + "rel": Relations.queryables.value, + "type": MimeTypes.jsonschema, + "title": "Queryables", + "href": urljoin(base_url, "queryables"), + "method": "GET", + } + ) + # Add Collections links collections = self.all_collections(request=kwargs["request"]) for collection in collections["collections"]: @@ -573,6 +578,20 @@ async def landing_page(self, **kwargs) -> stac_types.LandingPage: conformance_classes=self.conformance_classes(), extension_schemas=[], ) + + # Add Queryables link + if self.extension_is_enabled("FilterExtension"): + landing_page["links"].append( + { + "rel": Relations.queryables.value, + "type": MimeTypes.jsonschema, + "title": "Queryables", + "href": urljoin(base_url, "queryables"), + "method": "GET", + } + ) + + # Add Collections links collections = await self.all_collections(request=kwargs["request"]) for collection in collections["collections"]: landing_page["links"].append(