From 145047a9f89034217b3fe23c129807235c7d26f4 Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Thu, 6 Jul 2023 11:56:36 +0200 Subject: [PATCH 1/4] Adding link to collection queryables --- stac_fastapi/pgstac/models/links.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stac_fastapi/pgstac/models/links.py b/stac_fastapi/pgstac/models/links.py index 8ba435d4..dec9adb9 100644 --- a/stac_fastapi/pgstac/models/links.py +++ b/stac_fastapi/pgstac/models/links.py @@ -204,6 +204,14 @@ def link_items(self) -> Dict: href=self.resolve(f"collections/{self.collection_id}/items"), ) + def link_queryables(self) -> Dict: + """Create the `queryables` link.""" + return dict( + rel=Relations.queryables.value, + type=MimeTypes.json.value, + href=self.resolve(f"collections/{self.collection_id}/queryables"), + ) + @attr.s class ItemCollectionLinks(CollectionLinksBase): From f14ff10131a37229ddf683436252334fa5a6ddad Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Thu, 6 Jul 2023 12:02:01 +0200 Subject: [PATCH 2/4] Fixing mime-type for queryables. Adding queryables link rel to inferred link rels --- stac_fastapi/pgstac/models/links.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stac_fastapi/pgstac/models/links.py b/stac_fastapi/pgstac/models/links.py index dec9adb9..b0a2c6ce 100644 --- a/stac_fastapi/pgstac/models/links.py +++ b/stac_fastapi/pgstac/models/links.py @@ -11,7 +11,7 @@ # These can be inferred from the item/collection so they aren't included in the database # Instead they are dynamically generated when querying the database using the classes defined below -INFERRED_LINK_RELS = ["self", "item", "parent", "collection", "root"] +INFERRED_LINK_RELS = ["self", "item", "parent", "collection", "root", Relations.queryables.value] def filter_links(links: List[Dict]) -> List[Dict]: @@ -208,7 +208,7 @@ def link_queryables(self) -> Dict: """Create the `queryables` link.""" return dict( rel=Relations.queryables.value, - type=MimeTypes.json.value, + type=MimeTypes.schemajson.value, href=self.resolve(f"collections/{self.collection_id}/queryables"), ) From 3a1dae77d9dd812789e16baf204b8e5cf7c597c8 Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Thu, 6 Jul 2023 12:05:37 +0200 Subject: [PATCH 3/4] Adding changelog entry for queryables PR --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index e5de2e54..ee8ce843 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Add `/queryables` link to the collections ([#49](https://github.com/stac-utils/stac-fastapi-pgstac/pull/49)) + ## [2.4.9] - 2023-06-21 ### Fixed From 5637529e39add8f7bb74d35fc124d04e60d12556 Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Thu, 6 Jul 2023 13:13:39 +0200 Subject: [PATCH 4/4] Fixing schemajson -> jsonschema --- stac_fastapi/pgstac/models/links.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stac_fastapi/pgstac/models/links.py b/stac_fastapi/pgstac/models/links.py index b0a2c6ce..2da66df3 100644 --- a/stac_fastapi/pgstac/models/links.py +++ b/stac_fastapi/pgstac/models/links.py @@ -208,7 +208,7 @@ def link_queryables(self) -> Dict: """Create the `queryables` link.""" return dict( rel=Relations.queryables.value, - type=MimeTypes.schemajson.value, + type=MimeTypes.jsonschema.value, href=self.resolve(f"collections/{self.collection_id}/queryables"), )