Skip to content

Commit e37715e

Browse files
committed
Update names on duplicate with config option
1 parent 1b8299e commit e37715e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

openapi_python_client/parser/properties/model_property.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ def build(
7474
else:
7575
class_string = title
7676
class_info = Class.from_string(string=class_string, config=config)
77+
if config.enumerate_duplicate_model_names:
78+
suffix = 2
79+
while class_info.name in schemas.classes_by_name:
80+
class_info = Class.from_string(string=class_string + str(suffix), config=config)
81+
suffix += 1
7782
model_roots = {*roots, class_info.name}
7883
required_properties: list[Property] | None = None
7984
optional_properties: list[Property] | None = None

0 commit comments

Comments
 (0)