@@ -461,8 +461,10 @@ def _disable_service_instances_if_direct(cls, value: bool, info: ValidationInfo)
461461
462462def process_property (key , value , depth = 0 ):
463463 extra_white_space = " " * depth
464- default = value .get ("default" , "" )
465- if isinstance (default , dict ):
464+ default = value .get ("default" )
465+ if default is None :
466+ default = ""
467+ elif isinstance (default , dict ):
466468 # Little hack that prevents listing the default value for tusd in the sample config
467469 default = {}
468470 if default != "" :
@@ -472,11 +474,14 @@ def process_property(key, value, depth=0):
472474 default = default [: - (len ("\n ...\n " ))]
473475 default = default .strip ()
474476 description = "\n " .join (f"{ extra_white_space } # { desc } " .rstrip () for desc in value ["description" ].strip ().split ("\n " ))
475- combined = value .get ("allOf" , [])
476- if not combined and value .get ("anyOf" ):
477+ if value .get ("anyOf" ):
477478 # we've got a union
478- combined = [c for c in value ["anyOf" ] if c ["type" ] == "object" ]
479- if combined and combined [0 ].get ("properties" ):
479+ combined = [c for c in value ["anyOf" ] if c ["type" ] != "null" ]
480+ elif "enum" in value or "properties" in value :
481+ combined = [value ]
482+ else :
483+ combined = []
484+ if combined and any (item .get ("properties" ) for item in combined ):
480485 # we've got a nested map, add key once
481486 description = f"{ description } \n { extra_white_space } { key } :\n "
482487 has_child = False
@@ -506,7 +511,5 @@ def settings_to_sample():
506511 # expand schema for easier processing
507512 data = jsonref .replace_refs (schema , merge_props = True )
508513 strings = [process_property ("gravity" , data )]
509- for key , value in data ["properties" ].items ():
510- strings .append (process_property (key , value , 1 ))
511514 concat = "\n " .join (strings )
512515 return concat
0 commit comments