Skip to content

Commit c3e1cd0

Browse files
Patch/add titles in links (#805)
* defined links title in landing page * update changelog * fix
1 parent 54c85ab commit c3e1cd0

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Added
6+
7+
- titles in `Landing` page links
8+
59
### Changed
610

711
- remove `child` links (`collections`) in landing page response

stac_fastapi/api/tests/test_app.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ def get_search(
188188
)
189189

190190
assert landing.status_code == 200, landing.text
191-
assert "Queryables" in [link.get("title") for link in landing.json()["links"]]
191+
assert "Queryables available for this Catalog" in [
192+
link.get("title") for link in landing.json()["links"]
193+
]
192194
assert get_search.status_code == 200, get_search.text
193195
assert post_search.status_code == 200, post_search.text
194196

@@ -221,7 +223,9 @@ def get_search(
221223
)
222224

223225
assert landing.status_code == 200, landing.text
224-
assert "Queryables" in [link.get("title") for link in landing.json()["links"]]
226+
assert "Queryables available for this Catalog" in [
227+
link.get("title") for link in landing.json()["links"]
228+
]
225229
assert get_search.status_code == 200, get_search.text
226230
assert post_search.status_code == 200, post_search.text
227231

stac_fastapi/api/tests/test_app_prefix.py

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def test_api_prefix(TestCoreClient, prefix):
6464

6565
link_tests = [
6666
("root", "application/json", "/"),
67+
("self", "application/json", "/"),
6768
("conformance", "application/json", "/conformance"),
6869
("data", "application/json", "/collections"),
6970
("search", "application/geo+json", "/search"),
@@ -126,6 +127,7 @@ def test_async_api_prefix(AsyncTestCoreClient, prefix):
126127

127128
link_tests = [
128129
("root", "application/json", "/"),
130+
("self", "application/json", "/"),
129131
("conformance", "application/json", "/conformance"),
130132
("data", "application/json", "/collections"),
131133
("search", "application/geo+json", "/search"),
@@ -190,6 +192,7 @@ def test_api_prefix_with_root_path(TestCoreClient, prefix):
190192

191193
link_tests = [
192194
("root", "application/json", "/"),
195+
("self", "application/json", "/"),
193196
("conformance", "application/json", "/conformance"),
194197
("data", "application/json", "/collections"),
195198
("search", "application/geo+json", "/search"),

stac_fastapi/types/stac_fastapi/types/core.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,19 @@ def _landing_page(
289289
{
290290
"rel": Relations.self.value,
291291
"type": MimeTypes.json.value,
292+
"title": "This document",
292293
"href": base_url,
293294
},
294295
{
295296
"rel": Relations.root.value,
296297
"type": MimeTypes.json.value,
298+
"title": "Root",
297299
"href": base_url,
298300
},
299301
{
300302
"rel": Relations.data.value,
301303
"type": MimeTypes.json.value,
304+
"title": "Collections available for this Catalog",
302305
"href": urljoin(base_url, "collections"),
303306
},
304307
{
@@ -310,14 +313,14 @@ def _landing_page(
310313
{
311314
"rel": Relations.search.value,
312315
"type": MimeTypes.geojson.value,
313-
"title": "STAC search",
316+
"title": "STAC search [GET]",
314317
"href": urljoin(base_url, "search"),
315318
"method": "GET",
316319
},
317320
{
318321
"rel": Relations.search.value,
319322
"type": MimeTypes.geojson.value,
320-
"title": "STAC search",
323+
"title": "STAC search [POST]",
321324
"href": urljoin(base_url, "search"),
322325
"method": "POST",
323326
},
@@ -391,7 +394,7 @@ def landing_page(self, **kwargs) -> stac.LandingPage:
391394
{
392395
"rel": Relations.queryables.value,
393396
"type": MimeTypes.jsonschema.value,
394-
"title": "Queryables",
397+
"title": "Queryables available for this Catalog",
395398
"href": urljoin(base_url, "queryables"),
396399
}
397400
)
@@ -601,7 +604,7 @@ async def landing_page(self, **kwargs) -> stac.LandingPage:
601604
{
602605
"rel": Relations.queryables.value,
603606
"type": MimeTypes.jsonschema.value,
604-
"title": "Queryables",
607+
"title": "Queryables available for this Catalog",
605608
"href": urljoin(base_url, "queryables"),
606609
"method": "GET",
607610
}

0 commit comments

Comments
 (0)