[python] Fix postponed model imports (#16882)

* replaced method used on model to import the model not the mapping name

* replaced method used on model to import the model not the mapping name
This commit is contained in:
OliverTetzTT 2023-11-01 17:59:19 +01:00 committed by GitHub
parent 4302d37f52
commit 4402635d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -929,7 +929,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
typingImports.add("Union");
Set<CodegenDiscriminator.MappedModel> discriminator = model.getDiscriminator().getMappedModels();
for (CodegenDiscriminator.MappedModel mappedModel : discriminator) {
postponedModelImports.add(mappedModel.getMappingName());
postponedModelImports.add(mappedModel.getModelName());
}
}
}

View File

@ -881,7 +881,7 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
typingImports.add("Union");
Set<CodegenDiscriminator.MappedModel> discriminator = model.getDiscriminator().getMappedModels();
for (CodegenDiscriminator.MappedModel mappedModel : discriminator) {
postponedModelImports.add(mappedModel.getMappingName());
postponedModelImports.add(mappedModel.getModelName());
}
}
}