@@ -49,7 +49,7 @@ def type_converter( # noqa: C901
49
49
if isinstance (sub_schema , Schema ):
50
50
conversions .append (type_converter (sub_schema , True ))
51
51
else :
52
- import_type = sub_schema .ref .split ("/" )[- 1 ]
52
+ import_type = common . normalize_symbol ( sub_schema .ref .split ("/" )[- 1 ])
53
53
if import_type == model_name :
54
54
conversions .append (
55
55
TypeConversion (
@@ -91,7 +91,7 @@ def type_converter( # noqa: C901
91
91
if isinstance (sub_schema , Schema ):
92
92
conversions .append (type_converter (sub_schema , True ))
93
93
else :
94
- import_type = sub_schema .ref .split ("/" )[- 1 ]
94
+ import_type = common . normalize_symbol ( sub_schema .ref .split ("/" )[- 1 ])
95
95
import_types = [f"from .{ import_type } import { import_type } " ]
96
96
conversions .append (
97
97
TypeConversion (
@@ -221,7 +221,7 @@ def _generate_property_from_reference(
221
221
and parent_schema .required is not None
222
222
and name in parent_schema .required
223
223
) or force_required
224
- import_model = reference .ref .split ("/" )[- 1 ]
224
+ import_model = common . normalize_symbol ( reference .ref .split ("/" )[- 1 ])
225
225
226
226
if import_model == model_name :
227
227
type_conv = TypeConversion (
@@ -262,7 +262,8 @@ def generate_models(components: Components) -> List[Model]:
262
262
if components .schemas is None :
263
263
return models
264
264
265
- for name , schema_or_reference in components .schemas .items ():
265
+ for schema_name , schema_or_reference in components .schemas .items ():
266
+ name = common .normalize_symbol (schema_name )
266
267
if schema_or_reference .enum is not None :
267
268
value_dict = schema_or_reference .dict ()
268
269
regex = re .compile (r"[\s\/=\*\+]+" )
0 commit comments