Skip to content

Commit f40236c

Browse files
authored
fix: set preserve order for serde (#93)
Closes #85.
1 parent 16f757b commit f40236c

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1111

1212
### Fixed
1313

14-
- Deterministic asset ordering ([rustac #709](https://github.com/stac-utils/rustac/pull/709))
14+
- Deterministic asset ordering ([rustac #709](https://github.com/stac-utils/rustac/pull/709), [#93](https://github.com/stac-utils/rustac-py/pull/93))
1515

1616
## [0.6.0] - 2025-04-18
1717

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pyo3-async-runtimes = { version = "0.24.0", features = [
2323
pyo3-arrow = "0.8.0"
2424
pythonize = "0.24.0"
2525
serde = "1.0.217"
26-
serde_json = "1.0.138"
26+
serde_json = { version = "1.0.138", features = ["preserve_order"] }
2727
stac = { features = [
2828
"geoparquet-compression",
2929
"object-store-all",

tests/test_read.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@
77
async def test_read(examples: Path) -> None:
88
item = Item.from_dict(await rustac.read(str(examples / "simple-item.json")))
99
item.validate()
10+
11+
12+
async def test_asset_ordering(examples: Path) -> None:
13+
# Not a perfect test but should be good enough for https://github.com/stac-utils/rustac-py/issues/85
14+
lists = []
15+
for _ in range(10):
16+
item = await rustac.read(str(examples / "extended-item.json"))
17+
lists.append(list(item["assets"].keys()))
18+
for sublist in lists[1:]:
19+
assert lists[0] == sublist

0 commit comments

Comments
 (0)