diff --git a/openeo_driver/views.py b/openeo_driver/views.py index ffccedc1..6d08ea99 100644 --- a/openeo_driver/views.py +++ b/openeo_driver/views.py @@ -1116,6 +1116,7 @@ def job_results_canonical_url() -> str: job_id=job_id, user_id=user_id ) result_assets = result_metadata.assets + result_items = result_metadata.items providers = result_metadata.providers # TODO: remove feature toggle, during refactoring for openeo-geopyspark-driver#440 @@ -1187,10 +1188,16 @@ def job_result_item_url(item_id, is11 = False) -> str: if len(result_metadata.items) > 0 : + assets = { + item_key + "_" + asset_key: asset_metadata + for item_key, item_metadata in result_items.items() + for asset_key, asset_metadata in item_metadata.get("assets").items() + } for item_id in result_metadata.items.keys(): links.append( {"rel": "item", "href": job_result_item_url(item_id=item_id, is11=True), "type": stac_item_media_type} ) + stac_version = "1.1.0" else: for filename, metadata in result_assets.items(): @@ -1206,11 +1213,12 @@ def job_result_item_url(item_id, is11 = False) -> str: links.append( {"rel": "item", "href": job_result_item_url(item_id=filename), "type": "application/json"} ) + stac_version = "1.0.0" result = dict_no_none( { "type": "Collection", - "stac_version": "1.0.0", + "stac_version": stac_version, "stac_extensions": [ STAC_EXTENSION.EO_V110, STAC_EXTENSION.FILEINFO, diff --git a/tests/test_views.py b/tests/test_views.py index de944d03..7cedb0ca 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -2930,6 +2930,9 @@ def test_get_job_results_from_stac_1_1_items(self, api110, backend_config_overri resp = api110.get(f"/jobs/{job_id}/results", headers=self.AUTH_HEADER).assert_status_code(200) + assert "assets" in resp.json + assert resp.json.get("stac_version") == "1.1.0" + item_links = [link for link in resp.json["links"] if link["rel"] == "item"] assert len(item_links) == 1, "expected exactly one item link in STAC Collection"