diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_generic.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_generic.mustache index a9ba41b394a9..5422b0790d0f 100644 --- a/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_generic.mustache @@ -17,7 +17,7 @@ from typing import TYPE_CHECKING from importlib import import_module if TYPE_CHECKING: {{#mappedModels}} - from {{packageName}}.models.{{model.classVarName}} import {{modelName}} + from {{packageName}}.models.{{model.classFilename}} import {{modelName}} {{/mappedModels}} {{/discriminator}} @@ -238,7 +238,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} object_type = cls.get_discriminator_value(obj) {{#mappedModels}} if object_type == '{{{modelName}}}': - return import_module("{{packageName}}.models.{{model.classVarName}}").{{modelName}}.from_dict(obj) + return import_module("{{packageName}}.models.{{model.classFilename}}").{{modelName}}.from_dict(obj) {{/mappedModels}} raise ValueError("{{{classname}}} failed to lookup discriminator value from " + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + diff --git a/modules/openapi-generator/src/main/resources/python/model_generic.mustache b/modules/openapi-generator/src/main/resources/python/model_generic.mustache index efd8e3041684..9fa35c84fab4 100644 --- a/modules/openapi-generator/src/main/resources/python/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_generic.mustache @@ -18,7 +18,7 @@ from typing_extensions import Self from typing import TYPE_CHECKING if TYPE_CHECKING: {{#mappedModels}} - from {{packageName}}.models.{{model.classVarName}} import {{modelName}} + from {{packageName}}.models.{{model.classFilename}} import {{modelName}} {{/mappedModels}} {{/discriminator}} @@ -261,7 +261,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} object_type = cls.get_discriminator_value(obj) {{#mappedModels}} if object_type == '{{{modelName}}}': - return import_module("{{packageName}}.models.{{model.classVarName}}").{{modelName}}.from_dict(obj) + return import_module("{{packageName}}.models.{{model.classFilename}}").{{modelName}}.from_dict(obj) {{/mappedModels}} raise ValueError("{{{classname}}} failed to lookup discriminator value from " +