Skip to content

Commit 39029a4

Browse files
committed
fix: add required links to item collection
sqlalchemy
1 parent c46fdc0 commit 39029a4

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/core.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,23 @@ def item_collection(
169169
else None
170170
)
171171

172-
links = []
172+
links = [
173+
{
174+
"rel": Relations.self.value,
175+
"type": "application/geo+json",
176+
"href": str(kwargs["request"].url),
177+
},
178+
{
179+
"rel": Relations.root.value,
180+
"type": "application/json",
181+
"href": str(kwargs["request"].base_url),
182+
},
183+
{
184+
"rel": Relations.parent.value,
185+
"type": "application/json",
186+
"href": str(kwargs["request"].base_url),
187+
},
188+
]
173189
if page.next:
174190
links.append(
175191
{

stac_fastapi/sqlalchemy/tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def load_file(filename: str) -> Dict:
7070

7171
class MockStarletteRequest:
7272
base_url = "http://test-server"
73+
url = "http://test-server/some/endpoint"
7374

7475

7576
@pytest.fixture

0 commit comments

Comments
 (0)