Skip to content

Commit 0ae50f5

Browse files
authored
Fixes #22146. Fixed the code to call the correct method to prevent duplication of Prefix added to the model when using --model-name-prefix (#22188)
* Fixes #22146 * Added handling for when super.getSchemaType method returns null
1 parent 3347204 commit 0ae50f5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,13 @@ public String getTypeDeclaration(Schema p) {
671671
return getSchemaType(p) + "[str, " + getCollectionItemTypeDeclaration(inner) + "]";
672672
}
673673

674-
String openAPIType = getSchemaType(p);
674+
String openAPIType = super.getSchemaType(p);
675+
676+
if (openAPIType == null) {
677+
LOGGER.error("OpenAPI Type for {} is null. Default to UNKNOWN_OPENAPI_TYPE instead.", p.getName());
678+
openAPIType = "UNKNOWN_OPENAPI_TYPE";
679+
}
680+
675681
if (typeMapping.containsKey(openAPIType)) {
676682
return typeMapping.get(openAPIType);
677683
}

0 commit comments

Comments
 (0)