Skip to content

Commit ab747be

Browse files
authored
Update migrate code to handle license updates for v1.1.0 (#1491)
* Migrate license from 'various' and 'proprietary' to 'other' * Update license in 1.1.0 test files * Remove item-assets extension from v1.1.0 files
1 parent 24e16e4 commit ab747be

File tree

32 files changed

+53
-53
lines changed

32 files changed

+53
-53
lines changed

pystac/serialization/migrate.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def _migrate_catalog(
2020
d: dict[str, Any], version: STACVersionID, info: STACJSONDescription
2121
) -> None:
2222
d["type"] = pystac.STACObjectType.CATALOG
23+
_migrate_license(d)
2324

2425

2526
def _migrate_collection_summaries(
@@ -38,25 +39,20 @@ def _migrate_collection(
3839
d: dict[str, Any], version: STACVersionID, info: STACJSONDescription
3940
) -> None:
4041
d["type"] = pystac.STACObjectType.COLLECTION
42+
_migrate_license(d)
4143
_migrate_collection_summaries(d, version, info)
4244

4345

4446
def _migrate_item(
4547
d: dict[str, Any], version: STACVersionID, info: STACJSONDescription
4648
) -> None:
47-
# No migrations necessary for supported STAC versions (>=0.8)
48-
pass
49+
_migrate_license(d["properties"])
4950

5051

51-
# Extensions
52-
def _migrate_item_assets(
53-
d: dict[str, Any], version: STACVersionID, info: STACJSONDescription
54-
) -> set[str] | None:
55-
if version < "1.0.0-beta.2":
56-
if info.object_type == pystac.STACObjectType.COLLECTION:
57-
if "assets" in d:
58-
d["item_assets"] = d["assets"]
59-
del d["assets"]
52+
def _migrate_license(d: dict[str, Any]) -> None:
53+
if d.get("license") in ["various", "proprietary"]:
54+
d["license"] = "other"
55+
6056
return None
6157

6258

@@ -158,11 +154,6 @@ def _get_removed_extension_migrations() -> (
158154
}
159155

160156

161-
# TODO: Item Assets
162-
def _get_extension_renames() -> dict[str, str]:
163-
return {"asset": "item-assets"}
164-
165-
166157
def migrate_to_latest(
167158
json_dict: dict[str, Any], info: STACJSONDescription
168159
) -> dict[str, Any]:

tests/data-files/catalogs/cbers-partial/CBERS4AWFI/collection.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
}
1717
],
1818
"stac_extensions": [
19-
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
20-
"https://schemas.stacspec.org/v1.0.0-beta.2/extensions/item-assets/json-schema/schema.json"
19+
"https://stac-extensions.github.io/eo/v1.1.0/schema.json"
2120
],
2221
"providers": [
2322
{

tests/data-files/catalogs/cbers-partial/CBERS4MUX/collection.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
}
1717
],
1818
"stac_extensions": [
19-
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
20-
"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json"
19+
"https://stac-extensions.github.io/eo/v1.1.0/schema.json"
2120
],
2221
"providers": [
2322
{

tests/data-files/catalogs/cbers-partial/CBERS4PAN10M/collection.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
}
1717
],
1818
"stac_extensions": [
19-
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
20-
"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json"
19+
"https://stac-extensions.github.io/eo/v1.1.0/schema.json"
2120
],
2221
"providers": [
2322
{

tests/data-files/catalogs/cbers-partial/CBERS4PAN5M/collection.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
}
1717
],
1818
"stac_extensions": [
19-
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
20-
"https://stac-extensions.github.io/item-assets/v1.0.0/schema.json"
19+
"https://stac-extensions.github.io/eo/v1.1.0/schema.json"
2120
],
2221
"providers": [
2322
{

tests/data-files/catalogs/test-case-1/country-1/area-1-1/collection.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
]
4747
}
4848
},
49-
"license": "proprietary"
49+
"license": "other"
5050
}

tests/data-files/catalogs/test-case-1/country-1/area-1-2/collection.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
]
4747
}
4848
},
49-
"license": "proprietary"
49+
"license": "other"
5050
}

tests/data-files/catalogs/test-case-1/country-2/area-2-1/collection.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
]
4747
}
4848
},
49-
"license": "proprietary"
49+
"license": "other"
5050
}

tests/data-files/catalogs/test-case-1/country-2/area-2-2/collection.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
]
4747
}
4848
},
49-
"license": "proprietary"
49+
"license": "other"
5050
}

tests/data-files/catalogs/test-case-2/1a8c1632-fa91-4a62-b33e-3a87c2ebdf16/5b922d42-9a77-4f79-a672-86096f7f849e/collection.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@
4747
]
4848
}
4949
},
50-
"license": "proprietary"
50+
"license": "other"
5151
}

0 commit comments

Comments
 (0)