From b59523b7679c98ff36037da0304660c4333538e2 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Mon, 22 Apr 2024 18:22:46 +0800 Subject: [PATCH 01/12] first run --- scripts/ingest_joplin.py | 2 +- setup.py | 6 +++--- stac_fastapi/pgstac/core.py | 32 +++++++++++++++++++++++++++++- tests/api/test_api.py | 2 +- tests/clients/test_postgres.py | 2 +- tests/resources/test_collection.py | 4 ++-- tests/resources/test_item.py | 7 ++++--- 7 files changed, 43 insertions(+), 12 deletions(-) diff --git a/scripts/ingest_joplin.py b/scripts/ingest_joplin.py index 6d273217..0440d094 100644 --- a/scripts/ingest_joplin.py +++ b/scripts/ingest_joplin.py @@ -19,7 +19,7 @@ def post_or_put(url: str, data: dict): """Post or put data to url.""" r = requests.post(url, json=data) if r.status_code == 409: - new_url = url if data["type"] == "Collection" else url + f"/{data['id']}" + new_url = url + f"/{data['id']}" # Exists, so update r = requests.put(new_url, json=data) # Unchanged may throw a 404 diff --git a/setup.py b/setup.py index 568ee5ba..1bb81b17 100644 --- a/setup.py +++ b/setup.py @@ -10,9 +10,9 @@ "orjson", "pydantic[dotenv]>=1.10.8", # https://github.com/pydantic/pydantic/issues/5821 "stac_pydantic==2.0.*", - "stac-fastapi.types~=2.4.9", - "stac-fastapi.api~=2.4.9", - "stac-fastapi.extensions~=2.4.9", + "stac-fastapi.types~=2.5.2", + "stac-fastapi.api~=2.5.2", + "stac-fastapi.extensions~=2.5.2", "asyncpg", "buildpg", "brotli_asgi", diff --git a/stac_fastapi/pgstac/core.py b/stac_fastapi/pgstac/core.py index ef20f25d..161b0500 100644 --- a/stac_fastapi/pgstac/core.py +++ b/stac_fastapi/pgstac/core.py @@ -5,6 +5,7 @@ from urllib.parse import unquote_plus, urljoin import attr +import json import orjson from asyncpg.exceptions import InvalidDatetimeFormatError from buildpg import render @@ -16,6 +17,7 @@ from stac_fastapi.types.core import AsyncBaseCoreClient from stac_fastapi.types.errors import InvalidQueryParameter, NotFoundError from stac_fastapi.types.requests import get_base_url +from stac_fastapi.types.rfc3339 import DateTimeType from stac_fastapi.types.stac import Collection, Collections, Item, ItemCollection from stac_pydantic.links import Relations from stac_pydantic.shared import MimeTypes @@ -159,6 +161,8 @@ async def _search_base( search_request.conf["nohydrate"] = settings.use_api_hydrate search_request_json = search_request.json(exclude_none=True, by_alias=True) + print(search_request_json) + try: async with request.app.state.get_connection(request, "r") as conn: q, p = render( @@ -269,6 +273,13 @@ async def item_collection( # If collection does not exist, NotFoundError wil be raised await self.get_collection(collection_id, request=request) + query_params = dict(request.query_params) # Convert MultiDict to dict + + # I am not sure why I have to do this .... as of stac-fastapi 2.5.2 + if "datetime" in query_params: + datetime = query_params["datetime"] + print("datetime: ", datetime) + base_args = { "collections": [collection_id], "bbox": bbox, @@ -387,8 +398,27 @@ async def get_search( if datetime: base_args["datetime"] = datetime + # As of stac-fastapi 2.5.x, the intersects GET request parameter is being sent as a list if intersects: - base_args["intersects"] = orjson.loads(unquote_plus(intersects)) + intersects_dict = {"type": None, "coordinates": None} + + combined_json_string = intersects[0] + + # Iterate over the remaining fragments and add each with a preceding comma + for fragment in intersects[1:]: + combined_json_string += "," + fragment + + combined_json_string = combined_json_string.replace("'", "") + combined_json_string = "".join( + char for char in combined_json_string if char.isprintable() + ) + + try: + intersects_dict = json.loads(combined_json_string) + except json.JSONDecodeError as error: + print("Failed to parse JSON:", error) + + base_args["intersects"] = intersects_dict if sortby: # https://github.com/radiantearth/stac-spec/tree/master/api-spec/extensions/sort#http-get-or-post-form diff --git a/tests/api/test_api.py b/tests/api/test_api.py index 02f9505d..f317efc4 100644 --- a/tests/api/test_api.py +++ b/tests/api/test_api.py @@ -33,7 +33,7 @@ "DELETE /collections/{collection_id}/items/{item_id}", "POST /collections", "POST /collections/{collection_id}/items", - "PUT /collections", + "PUT /collections/{collection_id}", "PUT /collections/{collection_id}/items/{item_id}", ] diff --git a/tests/clients/test_postgres.py b/tests/clients/test_postgres.py index 964cbaf6..2dcbd88c 100644 --- a/tests/clients/test_postgres.py +++ b/tests/clients/test_postgres.py @@ -34,7 +34,7 @@ async def test_update_collection(app_client, load_test_collection): in_coll = load_test_collection in_coll.keywords.append("newkeyword") - resp = await app_client.put("/collections", json=in_coll.dict()) + resp = await app_client.put("/collections/{in_coll.id}", json=in_coll.dict()) assert resp.status_code == 200 resp = await app_client.get(f"/collections/{in_coll.id}") diff --git a/tests/resources/test_collection.py b/tests/resources/test_collection.py index 6910f0fe..e2e07050 100644 --- a/tests/resources/test_collection.py +++ b/tests/resources/test_collection.py @@ -32,7 +32,7 @@ async def test_update_collection(app_client, load_test_data, load_test_collectio in_coll = load_test_collection in_coll.keywords.append("newkeyword") - resp = await app_client.put("/collections", json=in_coll.dict()) + resp = await app_client.put("/collections/{in_coll.id}", json=in_coll.dict()) assert resp.status_code == 200 put_coll = Collection.parse_obj(resp.json()) @@ -88,7 +88,7 @@ async def test_update_new_collection(app_client, load_test_collection): in_coll = load_test_collection in_coll.id = "test-updatenew" - resp = await app_client.put("/collections", json=in_coll.dict()) + resp = await app_client.put("/collections/in_coll.id", json=in_coll.dict()) assert resp.status_code == 404 diff --git a/tests/resources/test_item.py b/tests/resources/test_item.py index 6929fbf7..90ece33c 100644 --- a/tests/resources/test_item.py +++ b/tests/resources/test_item.py @@ -39,7 +39,7 @@ async def test_update_collection(app_client, load_test_data, load_test_collectio in_coll = load_test_collection in_coll.keywords.append("newkeyword") - resp = await app_client.put("/collections", json=in_coll.dict()) + resp = await app_client.put(f"/collections/{in_coll.id}", json=in_coll.dict()) assert resp.status_code == 200 resp = await app_client.get(f"/collections/{in_coll.id}") @@ -1417,8 +1417,9 @@ async def test_search_datetime_validation_errors(app_client): resp = await app_client.post("/search", json=body) assert resp.status_code == 400 - resp = await app_client.get("/search?datetime={}".format(dt)) - assert resp.status_code == 400 + # ValueError: Invalid RFC3339 datetime. - not sure about this + # resp = await app_client.get("/search?datetime={}".format(dt)) + # assert resp.status_code == 400 async def test_get_filter_cql2text(app_client, load_test_data, load_test_collection): From 8bd744f973bda11f9709aa7f905328e292de8724 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Mon, 22 Apr 2024 18:56:40 +0800 Subject: [PATCH 02/12] fix f-strings --- stac_fastapi/pgstac/core.py | 4 +--- tests/clients/test_postgres.py | 2 +- tests/resources/test_collection.py | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/stac_fastapi/pgstac/core.py b/stac_fastapi/pgstac/core.py index 161b0500..c9fc3e25 100644 --- a/stac_fastapi/pgstac/core.py +++ b/stac_fastapi/pgstac/core.py @@ -161,8 +161,6 @@ async def _search_base( search_request.conf["nohydrate"] = settings.use_api_hydrate search_request_json = search_request.json(exclude_none=True, by_alias=True) - print(search_request_json) - try: async with request.app.state.get_connection(request, "r") as conn: q, p = render( @@ -278,7 +276,6 @@ async def item_collection( # I am not sure why I have to do this .... as of stac-fastapi 2.5.2 if "datetime" in query_params: datetime = query_params["datetime"] - print("datetime: ", datetime) base_args = { "collections": [collection_id], @@ -399,6 +396,7 @@ async def get_search( base_args["datetime"] = datetime # As of stac-fastapi 2.5.x, the intersects GET request parameter is being sent as a list + # There's a fix for this here: https://github.com/stac-utils/stac-fastapi/pull/668 if intersects: intersects_dict = {"type": None, "coordinates": None} diff --git a/tests/clients/test_postgres.py b/tests/clients/test_postgres.py index 2dcbd88c..0de8f4bb 100644 --- a/tests/clients/test_postgres.py +++ b/tests/clients/test_postgres.py @@ -34,7 +34,7 @@ async def test_update_collection(app_client, load_test_collection): in_coll = load_test_collection in_coll.keywords.append("newkeyword") - resp = await app_client.put("/collections/{in_coll.id}", json=in_coll.dict()) + resp = await app_client.put(f"/collections/{in_coll.id}", json=in_coll.dict()) assert resp.status_code == 200 resp = await app_client.get(f"/collections/{in_coll.id}") diff --git a/tests/resources/test_collection.py b/tests/resources/test_collection.py index e2e07050..9a3d9769 100644 --- a/tests/resources/test_collection.py +++ b/tests/resources/test_collection.py @@ -32,7 +32,7 @@ async def test_update_collection(app_client, load_test_data, load_test_collectio in_coll = load_test_collection in_coll.keywords.append("newkeyword") - resp = await app_client.put("/collections/{in_coll.id}", json=in_coll.dict()) + resp = await app_client.put(f"/collections/{in_coll.id}", json=in_coll.dict()) assert resp.status_code == 200 put_coll = Collection.parse_obj(resp.json()) @@ -88,7 +88,7 @@ async def test_update_new_collection(app_client, load_test_collection): in_coll = load_test_collection in_coll.id = "test-updatenew" - resp = await app_client.put("/collections/in_coll.id", json=in_coll.dict()) + resp = await app_client.put(f"/collections/in_coll.id", json=in_coll.dict()) assert resp.status_code == 404 From 3203c2704ee7eccf90a0e71f749e4858ac79de54 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Mon, 22 Apr 2024 19:27:53 +0800 Subject: [PATCH 03/12] lint --- stac_fastapi/pgstac/core.py | 3 +-- tests/resources/test_collection.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/stac_fastapi/pgstac/core.py b/stac_fastapi/pgstac/core.py index c9fc3e25..753f9aac 100644 --- a/stac_fastapi/pgstac/core.py +++ b/stac_fastapi/pgstac/core.py @@ -1,11 +1,11 @@ """Item crud client.""" +import json import re from datetime import datetime from typing import Any, Dict, List, Optional, Union from urllib.parse import unquote_plus, urljoin import attr -import json import orjson from asyncpg.exceptions import InvalidDatetimeFormatError from buildpg import render @@ -17,7 +17,6 @@ from stac_fastapi.types.core import AsyncBaseCoreClient from stac_fastapi.types.errors import InvalidQueryParameter, NotFoundError from stac_fastapi.types.requests import get_base_url -from stac_fastapi.types.rfc3339 import DateTimeType from stac_fastapi.types.stac import Collection, Collections, Item, ItemCollection from stac_pydantic.links import Relations from stac_pydantic.shared import MimeTypes diff --git a/tests/resources/test_collection.py b/tests/resources/test_collection.py index 9a3d9769..980428ef 100644 --- a/tests/resources/test_collection.py +++ b/tests/resources/test_collection.py @@ -88,7 +88,7 @@ async def test_update_new_collection(app_client, load_test_collection): in_coll = load_test_collection in_coll.id = "test-updatenew" - resp = await app_client.put(f"/collections/in_coll.id", json=in_coll.dict()) + resp = await app_client.put(f"/collections/{in_coll.id}", json=in_coll.dict()) assert resp.status_code == 404 From 35e2d6ac8f8708c76afd7a004f6b9c010b413cfb Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Tue, 23 Apr 2024 14:24:31 +0800 Subject: [PATCH 04/12] update for v2.5.3 --- setup.py | 6 ++-- stac_fastapi/pgstac/core.py | 47 ++++++++--------------------- stac_fastapi/pgstac/utils.py | 33 ++++++++++++++++++++ tests/resources/test_conformance.py | 6 +++- 4 files changed, 53 insertions(+), 39 deletions(-) diff --git a/setup.py b/setup.py index 1bb81b17..4c1e7bbd 100644 --- a/setup.py +++ b/setup.py @@ -10,9 +10,9 @@ "orjson", "pydantic[dotenv]>=1.10.8", # https://github.com/pydantic/pydantic/issues/5821 "stac_pydantic==2.0.*", - "stac-fastapi.types~=2.5.2", - "stac-fastapi.api~=2.5.2", - "stac-fastapi.extensions~=2.5.2", + "stac-fastapi.types~=2.5.3", + "stac-fastapi.api~=2.5.3", + "stac-fastapi.extensions~=2.5.3", "asyncpg", "buildpg", "brotli_asgi", diff --git a/stac_fastapi/pgstac/core.py b/stac_fastapi/pgstac/core.py index 753f9aac..e8cf1219 100644 --- a/stac_fastapi/pgstac/core.py +++ b/stac_fastapi/pgstac/core.py @@ -1,7 +1,5 @@ """Item crud client.""" -import json import re -from datetime import datetime from typing import Any, Dict, List, Optional, Union from urllib.parse import unquote_plus, urljoin @@ -17,9 +15,10 @@ from stac_fastapi.types.core import AsyncBaseCoreClient from stac_fastapi.types.errors import InvalidQueryParameter, NotFoundError from stac_fastapi.types.requests import get_base_url +from stac_fastapi.types.rfc3339 import DateTimeType from stac_fastapi.types.stac import Collection, Collections, Item, ItemCollection from stac_pydantic.links import Relations -from stac_pydantic.shared import MimeTypes +from stac_pydantic.shared import BBox, MimeTypes from stac_fastapi.pgstac.config import Settings from stac_fastapi.pgstac.models.links import ( @@ -29,7 +28,7 @@ PagingLinks, ) from stac_fastapi.pgstac.types.search import PgstacSearch -from stac_fastapi.pgstac.utils import filter_fields +from stac_fastapi.pgstac.utils import filter_fields, format_datetime_range NumType = Union[float, int] @@ -156,8 +155,12 @@ async def _search_base( settings: Settings = request.app.state.settings + if search_request.datetime: + search_request.datetime = format_datetime_range(search_request.datetime) + search_request.conf = search_request.conf or {} search_request.conf["nohydrate"] = settings.use_api_hydrate + search_request_json = search_request.json(exclude_none=True, by_alias=True) try: @@ -249,8 +252,8 @@ async def item_collection( self, collection_id: str, request: Request, - bbox: Optional[List[NumType]] = None, - datetime: Optional[Union[str, datetime]] = None, + bbox: Optional[BBox] = None, + datetime: Optional[DateTimeType] = None, limit: Optional[int] = None, token: str = None, **kwargs, @@ -270,12 +273,6 @@ async def item_collection( # If collection does not exist, NotFoundError wil be raised await self.get_collection(collection_id, request=request) - query_params = dict(request.query_params) # Convert MultiDict to dict - - # I am not sure why I have to do this .... as of stac-fastapi 2.5.2 - if "datetime" in query_params: - datetime = query_params["datetime"] - base_args = { "collections": [collection_id], "bbox": bbox, @@ -348,8 +345,8 @@ async def get_search( request: Request, collections: Optional[List[str]] = None, ids: Optional[List[str]] = None, - bbox: Optional[List[NumType]] = None, - datetime: Optional[Union[str, datetime]] = None, + bbox: Optional[BBox] = None, + datetime: Optional[DateTimeType] = None, limit: Optional[int] = None, query: Optional[str] = None, token: Optional[str] = None, @@ -394,28 +391,8 @@ async def get_search( if datetime: base_args["datetime"] = datetime - # As of stac-fastapi 2.5.x, the intersects GET request parameter is being sent as a list - # There's a fix for this here: https://github.com/stac-utils/stac-fastapi/pull/668 if intersects: - intersects_dict = {"type": None, "coordinates": None} - - combined_json_string = intersects[0] - - # Iterate over the remaining fragments and add each with a preceding comma - for fragment in intersects[1:]: - combined_json_string += "," + fragment - - combined_json_string = combined_json_string.replace("'", "") - combined_json_string = "".join( - char for char in combined_json_string if char.isprintable() - ) - - try: - intersects_dict = json.loads(combined_json_string) - except json.JSONDecodeError as error: - print("Failed to parse JSON:", error) - - base_args["intersects"] = intersects_dict + base_args["intersects"] = orjson.loads(unquote_plus(intersects)) if sortby: # https://github.com/radiantearth/stac-spec/tree/master/api-spec/extensions/sort#http-get-or-post-form diff --git a/stac_fastapi/pgstac/utils.py b/stac_fastapi/pgstac/utils.py index 4a0ce4c7..f696ca51 100644 --- a/stac_fastapi/pgstac/utils.py +++ b/stac_fastapi/pgstac/utils.py @@ -1,6 +1,8 @@ """stac-fastapi utility methods.""" +from datetime import datetime from typing import Any, Dict, Optional, Set, Union +from stac_fastapi.types.rfc3339 import DateTimeType from stac_fastapi.types.stac import Item @@ -113,3 +115,34 @@ def dict_deep_update(merge_to: Dict[str, Any], merge_from: Dict[str, Any]) -> No dict_deep_update(merge_to[k], merge_from[k]) else: merge_to[k] = v + + +def format_datetime_range(dt_range: DateTimeType) -> Union[str, Any]: + """ + Convert a datetime object or a tuple of datetime objects to a formatted string for datetime ranges. + + Args: + dt_range (DateTimeType): The date interval, + which might be a single datetime or a tuple with one or two datetimes. + + Returns: + str: A formatted string like 'YYYY-MM-DDTHH:MM:SSZ/..', 'YYYY-MM-DDTHH:MM:SSZ', or the original string input. + """ + # Handle a single datetime object + if isinstance(dt_range, datetime): + return dt_range.isoformat().replace("+00:00", "Z") + + # Handle a tuple containing datetime objects or None + if isinstance(dt_range, tuple): + start, end = dt_range + + # Convert start datetime to string if not None, otherwise use ".." + start_str = start.isoformat().replace("+00:00", "Z") if start else ".." + + # Convert end datetime to string if not None, otherwise use ".." + end_str = end.isoformat().replace("+00:00", "Z") if end else ".." + + return f"{start_str}/{end_str}" + + # Return input as-is if it's not any expected type (fallback) + return dt_range diff --git a/tests/resources/test_conformance.py b/tests/resources/test_conformance.py index b9f78852..bac2333f 100644 --- a/tests/resources/test_conformance.py +++ b/tests/resources/test_conformance.py @@ -54,7 +54,11 @@ async def test_landing_page_links( assert link.get("type") == expected_media_type link_path = urllib.parse.urlsplit(link.get("href")).path - assert link_path == app.state.router_prefix + expected_path + + # this feels hacky + assert link_path == ( + app.state.router_prefix + app.state.router_prefix + expected_path + ) or (app.state.router_prefix + expected_path) resp = await app_client.get(link_path.rsplit("/", 1)[-1]) assert resp.status_code == 200 From bea457eb2884435a395ee6169f805b797dc7671c Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Tue, 23 Apr 2024 14:28:49 +0800 Subject: [PATCH 05/12] update changelog --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 47718822..bf0af857 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Changed + +- Updated stac-fastapi libraries to v2.5.3 ([#101](https://github.com/stac-utils/stac-fastapi-pgstac/pull/101)) + ## [2.4.11] - 2023-12-01 ### Changed From 0ab045667f38a98c0d58c01d3125084ac9e2c110 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 25 Apr 2024 00:24:00 +0800 Subject: [PATCH 06/12] update, uncomment test --- setup.py | 6 +++--- tests/resources/test_item.py | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 0b72e51c..a7117d4e 100644 --- a/setup.py +++ b/setup.py @@ -10,9 +10,9 @@ "orjson", "pydantic[dotenv]>=1.10.8", # https://github.com/pydantic/pydantic/issues/5821 "stac_pydantic==2.0.*", - "stac-fastapi.types~=2.5.3", - "stac-fastapi.api~=2.5.3", - "stac-fastapi.extensions~=2.5.3", + "stac-fastapi.types~=2.5.4", + "stac-fastapi.api~=2.5.4", + "stac-fastapi.extensions~=2.5.4", "asyncpg", "buildpg", "brotli_asgi", diff --git a/tests/resources/test_item.py b/tests/resources/test_item.py index 90ece33c..93685db5 100644 --- a/tests/resources/test_item.py +++ b/tests/resources/test_item.py @@ -1417,9 +1417,8 @@ async def test_search_datetime_validation_errors(app_client): resp = await app_client.post("/search", json=body) assert resp.status_code == 400 - # ValueError: Invalid RFC3339 datetime. - not sure about this - # resp = await app_client.get("/search?datetime={}".format(dt)) - # assert resp.status_code == 400 + resp = await app_client.get("/search?datetime={}".format(dt)) + assert resp.status_code == 200 async def test_get_filter_cql2text(app_client, load_test_data, load_test_collection): From 9689fbe023f4bba9fd1ef2c84d2a533c70ead454 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 25 Apr 2024 00:31:18 +0800 Subject: [PATCH 07/12] fix test --- tests/resources/test_item.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/resources/test_item.py b/tests/resources/test_item.py index 93685db5..5fd4b044 100644 --- a/tests/resources/test_item.py +++ b/tests/resources/test_item.py @@ -1418,7 +1418,7 @@ async def test_search_datetime_validation_errors(app_client): assert resp.status_code == 400 resp = await app_client.get("/search?datetime={}".format(dt)) - assert resp.status_code == 200 + assert resp.status_code == 400 async def test_get_filter_cql2text(app_client, load_test_data, load_test_collection): From 34d5b13535d1c6f86d47a1b6205ccaadaf4ae0cf Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 25 Apr 2024 00:39:47 +0800 Subject: [PATCH 08/12] update changelog --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 76561d30..7fe92ebd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,7 @@ ### Changed -- Updated stac-fastapi libraries to v2.5.3 ([#101](https://github.com/stac-utils/stac-fastapi-pgstac/pull/101)) +- Updated stac-fastapi libraries to v2.5.4 ([#101](https://github.com/stac-utils/stac-fastapi-pgstac/pull/101)) - ### Added From ccae2bb0593bf43ddbb52a5c4fa263ac4e0b0c9b Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 25 Apr 2024 15:33:46 +0800 Subject: [PATCH 09/12] update --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index a7117d4e..92fcbffe 100644 --- a/setup.py +++ b/setup.py @@ -10,9 +10,9 @@ "orjson", "pydantic[dotenv]>=1.10.8", # https://github.com/pydantic/pydantic/issues/5821 "stac_pydantic==2.0.*", - "stac-fastapi.types~=2.5.4", - "stac-fastapi.api~=2.5.4", - "stac-fastapi.extensions~=2.5.4", + "stac-fastapi.types~=2.5.5", + "stac-fastapi.api~=2.5.5", + "stac-fastapi.extensions~=2.5.5", "asyncpg", "buildpg", "brotli_asgi", From 5d8e8fece8790e9cf070dd268a514b9db772de2d Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 25 Apr 2024 16:16:54 +0800 Subject: [PATCH 10/12] update test --- tests/resources/test_conformance.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/resources/test_conformance.py b/tests/resources/test_conformance.py index bac2333f..099bb399 100644 --- a/tests/resources/test_conformance.py +++ b/tests/resources/test_conformance.py @@ -56,9 +56,11 @@ async def test_landing_page_links( link_path = urllib.parse.urlsplit(link.get("href")).path # this feels hacky - assert link_path == ( - app.state.router_prefix + app.state.router_prefix + expected_path - ) or (app.state.router_prefix + expected_path) + # assert link_path == ( + # app.state.router_prefix + app.state.router_prefix + expected_path + # ) or (app.state.router_prefix + expected_path) + + assert link_path == app.state.router_prefix + expected_path resp = await app_client.get(link_path.rsplit("/", 1)[-1]) assert resp.status_code == 200 From e4e9edf5e581cae43b1a1f120272a44fb717359d Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Thu, 25 Apr 2024 20:12:55 +0800 Subject: [PATCH 11/12] update --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 92fcbffe..af3669dc 100644 --- a/setup.py +++ b/setup.py @@ -10,9 +10,9 @@ "orjson", "pydantic[dotenv]>=1.10.8", # https://github.com/pydantic/pydantic/issues/5821 "stac_pydantic==2.0.*", - "stac-fastapi.types~=2.5.5", - "stac-fastapi.api~=2.5.5", - "stac-fastapi.extensions~=2.5.5", + "stac-fastapi.types~=2.5.5.post1", + "stac-fastapi.api~=2.5.5.post1", + "stac-fastapi.extensions~=2.5.5.post1", "asyncpg", "buildpg", "brotli_asgi", From e2b713ed6ca61528f335078862d2c0c5d4595035 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Thu, 25 Apr 2024 15:12:24 +0200 Subject: [PATCH 12/12] remove comment --- tests/resources/test_conformance.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/resources/test_conformance.py b/tests/resources/test_conformance.py index 099bb399..b9f78852 100644 --- a/tests/resources/test_conformance.py +++ b/tests/resources/test_conformance.py @@ -54,12 +54,6 @@ async def test_landing_page_links( assert link.get("type") == expected_media_type link_path = urllib.parse.urlsplit(link.get("href")).path - - # this feels hacky - # assert link_path == ( - # app.state.router_prefix + app.state.router_prefix + expected_path - # ) or (app.state.router_prefix + expected_path) - assert link_path == app.state.router_prefix + expected_path resp = await app_client.get(link_path.rsplit("/", 1)[-1])