File tree 1 file changed +20
-2
lines changed
1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 13
13
for name , schema in data ['components' ]['schemas' ].items ():
14
14
if 'properties' in schema :
15
15
# Remove "null" item from nullable enums
16
- for name , prop in schema ['properties' ].items ():
16
+ for propName , prop in schema ['properties' ].items ():
17
17
if 'enum' in prop and None in prop ['enum' ]:
18
18
prop ['enum' ].remove (None )
19
19
if 'properties' in prop and 'value' in prop ['properties' ] and 'enum' in prop ['properties' ]['value' ] and None in prop ['properties' ]['value' ]['enum' ]:
39
39
for ntype in non_nullable_types :
40
40
if ntype in schema ['properties' ]:
41
41
if schema ['properties' ][ntype ]['format' ] == 'binary' :
42
- schema ['properties' ][ntype ].pop ('nullable' )
42
+ schema ['properties' ][ntype ].pop ('nullable' , None )
43
+
44
+ if 'required' in schema :
45
+ non_required_props = [
46
+ 'devicetype_count' ,
47
+ 'device_count' ,
48
+ 'virtualmachine_count' ,
49
+ 'prefix_count' ,
50
+ ]
51
+
52
+ schema ['required' ] = [prop for prop in schema ['required' ] if prop not in non_required_props ]
53
+
54
+ data ['components' ]['schemas' ]['Device' ]['required' ] = [
55
+ 'id' ,
56
+ 'url' ,
57
+ 'display' ,
58
+ 'name' ,
59
+ 'description' ,
60
+ ]
43
61
44
62
# Save the spec file
45
63
with open (SPEC_PATH , 'w' ) as file :
You can’t perform that action at this time.
0 commit comments