Skip to content

Commit 479d734

Browse files
authored
Correcting item collection fields numReturned & numMatched (#446)
**Description:** The `numReturned` & `numMatched` for the itemCollection type should be `numberReturned` & `numberMatched` https://github.com/radiantearth/stac-api-spec/blob/604ade6158de15b8ab068320ca41e25e2bf0e116/fragments/itemcollection/README.md#itemcollection-fields **PR Checklist:** - [x] Code is formatted and linted (run `pre-commit run --all-files`) - [x] Tests pass (run `make test`) - [x] Documentation has been updated to reflect changes, if applicable - [x] Changes are added to the changelog
1 parent 1d24a7b commit 479d734

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88

99
## [Unreleased]
1010

11+
### Changed
12+
13+
- updated `numReturned` & `numMatched` fields in itemCollection return to `numberReturned` & `numberMatched`. [#446](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/446)
14+
1115
## [v6.3.0] - 2025-09-16
1216

1317
### Added

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,8 @@ async def post_search(
596596
type="FeatureCollection",
597597
features=items,
598598
links=links,
599-
numReturned=len(items),
600-
numMatched=maybe_count,
599+
numberReturned=len(items),
600+
numberMatched=maybe_count,
601601
)
602602

603603

stac_fastapi/tests/api/test_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ async def test_app_context_results(app_client, txn_client, ctx, load_test_data):
130130

131131
resp_json = resp.json()
132132
assert len(resp_json["features"]) == 1
133-
assert resp_json["numReturned"] == 1
134-
if matched := resp_json.get("numMatched"):
133+
assert resp_json["numberReturned"] == 1
134+
if matched := resp_json.get("numberMatched"):
135135
assert matched == 1
136136

137137

stac_fastapi/tests/resources/test_item.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ async def test_get_item_collection(app_client, ctx, txn_client):
226226
assert resp.status_code == 200
227227

228228
item_collection = resp.json()
229-
if matched := item_collection.get("numMatched"):
229+
if matched := item_collection.get("numberMatched"):
230230
assert matched == item_count + 1
231231

232232

@@ -294,13 +294,13 @@ async def test_pagination(app_client, load_test_data):
294294
)
295295
assert resp.status_code == 200
296296
first_page = resp.json()
297-
assert first_page["numReturned"] == 3
297+
assert first_page["numberReturned"] == 3
298298

299299
url_components = urlsplit(first_page["links"][0]["href"])
300300
resp = await app_client.get(f"{url_components.path}?{url_components.query}")
301301
assert resp.status_code == 200
302302
second_page = resp.json()
303-
assert second_page["numReturned"] == 3
303+
assert second_page["numberReturned"] == 3
304304

305305

306306
@pytest.mark.skip(reason="created and updated fields not be added with stac fastapi 3?")
@@ -615,14 +615,14 @@ async def test_item_search_get_query_extension(app_client, ctx):
615615
),
616616
}
617617
resp = await app_client.get("/search", params=params)
618-
assert resp.json()["numReturned"] == 0
618+
assert resp.json()["numberReturned"] == 0
619619

620620
params["query"] = json.dumps(
621621
{"proj:epsg": {"eq": test_item["properties"]["proj:epsg"]}}
622622
)
623623
resp = await app_client.get("/search", params=params)
624624
resp_json = resp.json()
625-
assert resp_json["numReturned"] == 1
625+
assert resp_json["numberReturned"] == 1
626626
assert (
627627
resp_json["features"][0]["properties"]["proj:epsg"]
628628
== test_item["properties"]["proj:epsg"]

0 commit comments

Comments
 (0)