@@ -51,7 +51,7 @@ def type_converter( # noqa: C901
5151 :return: The converted type
5252 """
5353 # Handle Reference objects by converting them to type references
54- if isinstance (schema , Reference ):
54+ if isinstance (schema , Reference30 ) or isinstance ( schema , Reference31 ):
5555 import_type = common .normalize_symbol (schema .ref .split ("/" )[- 1 ])
5656 if required :
5757 converted_type = import_type
@@ -85,7 +85,7 @@ def type_converter( # noqa: C901
8585 if schema .allOf is not None :
8686 conversions = []
8787 for sub_schema in schema .allOf :
88- if isinstance (sub_schema , Schema ):
88+ if isinstance (sub_schema , Schema30 ) or isinstance ( sub_schema , Schema31 ):
8989 conversions .append (type_converter (sub_schema , True ))
9090 else :
9191 import_type = common .normalize_symbol (sub_schema .ref .split ("/" )[- 1 ])
@@ -130,7 +130,7 @@ def type_converter( # noqa: C901
130130 used = used if used is not None else []
131131 conversions = []
132132 for sub_schema in used :
133- if isinstance (sub_schema , Schema ):
133+ if isinstance (sub_schema , Schema30 ) or isinstance ( sub_schema , Schema31 ):
134134 conversions .append (type_converter (sub_schema , True ))
135135 else :
136136 import_type = common .normalize_symbol (sub_schema .ref .split ("/" )[- 1 ])
@@ -191,14 +191,14 @@ def type_converter( # noqa: C901
191191 converted_type = pre_type + "bool" + post_type
192192 elif schema .type == "array" or str (schema .type ) == "DataType.ARRAY" :
193193 retVal = pre_type + "List["
194- if isinstance (schema .items , Reference ):
194+ if isinstance (schema .items , Reference30 ) or isinstance ( schema . items , Reference31 ):
195195 converted_reference = _generate_property_from_reference (
196196 model_name or "" , "" , schema .items , schema , required
197197 )
198198 import_types = converted_reference .type .import_types
199199 original_type = "array<" + converted_reference .type .original_type + ">"
200200 retVal += converted_reference .type .converted_type
201- elif isinstance (schema .items , Schema ):
201+ elif isinstance (schema .items , Schema30 ) or isinstance ( schema . items , Schema31 ):
202202 type_str = schema .items .type
203203 if hasattr (type_str , "value" ):
204204 type_value = str (type_str .value ) if type_str is not None else "unknown"
@@ -440,7 +440,7 @@ def generate_models(
440440 else {}
441441 )
442442 for prop_name , property in property_iterator :
443- if isinstance (property , Reference ):
443+ if isinstance (property , Reference30 ) or isinstance ( property , Reference31 ):
444444 conv_property = _generate_property_from_reference (
445445 name , prop_name , property , schema_or_reference
446446 )
0 commit comments