File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 1818- Expand support for previous extension schema URIs ([ #1091 ] ( https://github.com/stac-utils/pystac/pull/1091 ) )
1919- Use ` pyproject.toml ` instead of ` setup.py ` ([ #1100 ] ( https://github.com/stac-utils/pystac/pull/1100 ) )
2020- ` DefaultStacIO ` now raises an error if it tries to write to a non-local url ([ #1107 ] ( https://github.com/stac-utils/pystac/pull/1107 ) )
21+ - Allow instantiation of pystac objects even with ` "stac_extensions": null ` ([ #1109 ] ( https://github.com/stac-utils/pystac/pull/1109 ) )
2122
2223### Deprecated
2324
Original file line number Diff line number Diff line change @@ -184,15 +184,10 @@ def migrate_to_latest(
184184
185185 if version != STACVersion .DEFAULT_STAC_VERSION :
186186 object_migrations [info .object_type ](result , version , info )
187- if "stac_extensions" not in result :
188- # Force stac_extensions property, as it makes
189- # downstream migration less complex
190- result ["stac_extensions" ] = []
191187 result ["stac_version" ] = STACVersion .DEFAULT_STAC_VERSION
192- else :
193- # Ensure stac_extensions property for consistency
194- if "stac_extensions" not in result :
195- result ["stac_extensions" ] = []
188+
189+ # Ensure stac_extensions property for consistency
190+ result ["stac_extensions" ] = result .get ("stac_extensions" , None ) or []
196191
197192 pystac .EXTENSION_HOOKS .migrate (result , version , info )
198193 for ext in result ["stac_extensions" ][:]:
Original file line number Diff line number Diff line change @@ -99,3 +99,13 @@ def test_should_raise_exception_when_passing_invalid_extension_object(
9999 match = r"^Item Assets extension does not apply to type 'object'$" ,
100100 ):
101101 ItemAssetsExtension .ext (object ()) # type: ignore
102+
103+
104+ def test_migrate_works_even_if_stac_extensions_is_null (
105+ test_case_1_catalog : pystac .Catalog ,
106+ ) -> None :
107+ collection = list (test_case_1_catalog .get_all_collections ())[0 ]
108+ collection_dict = collection .to_dict ()
109+ collection_dict ["stac_extensions" ] = None
110+
111+ pystac .Collection .from_dict (collection_dict , migrate = True )
You can’t perform that action at this time.
0 commit comments