File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1478,6 +1478,18 @@ def test_too_long_array(self):
14781478 ):
14791479 metadata .MetadataSchema (schema ).validate_and_encode_row (data2 )
14801480
1481+ def test_additional_properties (self ):
1482+ schema = {
1483+ "codec" : "struct" ,
1484+ "type" : "object" ,
1485+ "additional_properties" : True ,
1486+ "properties" : {},
1487+ }
1488+ with pytest .raises (
1489+ ValueError , match = "Struct codec does not support additional_properties"
1490+ ):
1491+ metadata .MetadataSchema (schema )
1492+
14811493
14821494class TestSLiMDecoding :
14831495 """
Original file line number Diff line number Diff line change @@ -455,6 +455,10 @@ def enforce_fixed_properties(obj):
455455 elif type (obj ) == dict :
456456 ret = {k : enforce_fixed_properties (v ) for k , v in obj .items ()}
457457 if ret .get ("type" ) == "object" :
458+ if ret .get ("additional_properties" ):
459+ raise ValueError (
460+ "Struct codec does not support additional_properties"
461+ )
458462 ret ["required" ] = list (ret .get ("properties" , {}).keys ())
459463 ret ["additionalProperties" ] = False
460464 return ret
You can’t perform that action at this time.
0 commit comments