File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 1313 for name , schema in data ['components' ]['schemas' ].items ():
1414 if 'properties' in schema :
1515 # Remove "null" item from nullable enums
16- for name , prop in schema ['properties' ].items ():
16+ for propName , prop in schema ['properties' ].items ():
1717 if 'enum' in prop and None in prop ['enum' ]:
1818 prop ['enum' ].remove (None )
1919 if 'properties' in prop and 'value' in prop ['properties' ] and 'enum' in prop ['properties' ]['value' ] and None in prop ['properties' ]['value' ]['enum' ]:
3939 for ntype in non_nullable_types :
4040 if ntype in schema ['properties' ]:
4141 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+ ]
4361
4462# Save the spec file
4563with open (SPEC_PATH , 'w' ) as file :
You can’t perform that action at this time.
0 commit comments