in src/aaz_dev/command/model/configuration/_content.py [0:0]
def _iter_over_schema(schema, schema_cls_map):
if schema.frozen:
return
if isinstance(schema, (CMDObjectSchemaBase, CMDObjectSchemaDiscriminator)):
if schema.props:
for idx in range(len(schema.props)):
s = schema.props[idx]
if getattr(s, 'cls', None):
if not schema_cls_map.get(s.cls, None):
schema_cls_map[s.cls] = s
else:
# replace by CMDClsSchema
schema.props[idx] = CMDClsSchema.build_from_schema(s, schema_cls_map[s.cls])
for prop in schema.props:
_iter_over_schema(prop, schema_cls_map)
if schema.discriminators:
for disc in schema.discriminators:
_iter_over_schema(disc, schema_cls_map)
if isinstance(schema, CMDObjectSchemaBase) and schema.additional_props and schema.additional_props.item:
s = schema.additional_props.item
if getattr(s, 'cls', None):
if not schema_cls_map.get(s.cls, None):
schema_cls_map[s.cls] = s
else:
# replace by CMDClsBaseSchema
schema.additional_props.item = CMDClsSchemaBase.build_from_schema_base(s, schema_cls_map[s.cls])
_iter_over_schema(schema.additional_props.item, schema_cls_map)
elif isinstance(schema, CMDArraySchemaBase):
s = schema.item
if getattr(s, 'cls', None):
if not schema_cls_map.get(s.cls, None):
schema_cls_map[s.cls] = s
else:
# replace by CMDClsBaseSchema
schema.item = CMDClsSchemaBase.build_from_schema_base(s, schema_cls_map[s.cls])
_iter_over_schema(schema.item, schema_cls_map)
elif isinstance(schema, CMDClsSchemaBase):
cls_name = schema.type[1:]
if cls_name not in schema_cls_map:
# set this cls name as None, in order to check where this cls_name miss cls definition
schema_cls_map[cls_name] = None