diff --git a/CHANGES.md b/CHANGES.md index b4ec0255..0d624c96 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). Note: Minor version `0.X.0` update might break the API, It's recommended to pin `tipg` to minor version: `tipg>=0.1,<0.2` +## [0.5.8] - 2024-01-10 + +- fix invalid streaming response formatting [backported from 0.6.0] + ## [0.5.7] - 2024-01-08 - add `tags` to all routes diff --git a/tipg/factory.py b/tipg/factory.py index 9cefbfa0..5d9e8070 100644 --- a/tipg/factory.py +++ b/tipg/factory.py @@ -753,19 +753,27 @@ async def items( # noqa: C901 MediaType.json, MediaType.ndjson, ): - rows = ( - { - k: v - for k, v in { + if any( + [f.get("geometry", None) is not None for f in item_list["items"]] + ): + rows = ( + { "collectionId": collection.id, "itemId": f.get("id"), **f.get("properties", {}), "geometry": f.get("geometry", None), - }.items() - if v is not None - } - for f in item_list["items"] - ) + } + for f in item_list["items"] + ) + else: + rows = ( + { + "collectionId": collection.id, + "itemId": f.get("id"), + **f.get("properties", {}), + } + for f in item_list["items"] + ) # CSV Response if output_type == MediaType.csv: