File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020- n/a
2121
2222### Fixed
23- - n/a
23+ - Fix check of disallowed unknown/undefined ` mlm: ` -prefixed fields
24+ (fixes [ #41 ] ( https://github.com/stac-extensions/mlm/issues/41 ) ).
2425
2526## [ v1.3.0] ( https://github.com/stac-extensions/mlm/tree/v1.3.0 )
2627
Original file line number Diff line number Diff line change 314314 },
315315 "$comment" : " Allow properties not defined by MLM prefix to allow combination with other extensions." ,
316316 "patternProperties" : {
317- "^(?!dlm :)" : {}
317+ "^(?!mlm :)" : {}
318318 },
319319 "additionalProperties" : false
320320 },
Original file line number Diff line number Diff line change @@ -27,6 +27,29 @@ def test_mlm_schema(
2727 assert SCHEMA_URI in validated
2828
2929
30+ @pytest .mark .parametrize (
31+ "mlm_example" ,
32+ ["item_raster_bands.json" ],
33+ indirect = True ,
34+ )
35+ def test_mlm_no_undefined_prefixed_field (
36+ mlm_validator : STACValidator ,
37+ mlm_example : Dict [str , JSON ],
38+ ) -> None :
39+ mlm_data = copy .deepcopy (mlm_example )
40+ mlm_item = pystac .Item .from_dict (mlm_data )
41+ pystac .validation .validate (mlm_item , validator = mlm_validator ) # ensure original is valid
42+
43+ mlm_data ["properties" ]["mlm:unknown" ] = "random" # type: ignore
44+ with pytest .raises (pystac .errors .STACValidationError ) as exc :
45+ mlm_item = pystac .Item .from_dict (mlm_data )
46+ pystac .validation .validate (mlm_item , validator = mlm_validator )
47+ assert all (
48+ field in str (exc .value .source )
49+ for field in ["mlm:unknown" , "^(?!mlm:)" ]
50+ )
51+
52+
3053@pytest .mark .parametrize (
3154 "mlm_example" ,
3255 ["item_raster_bands.json" ],
You can’t perform that action at this time.
0 commit comments