Skip to content

Commit 8eaeb2a

Browse files
authored
fix(java): Use modelNameMappings if provided (#18025)
1 parent ae9084b commit 8eaeb2a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,11 @@ public String toParamName(String name) {
870870

871871
@Override
872872
public String toModelName(final String name) {
873+
// obtain the name from modelNameMapping directly if provided
874+
if (modelNameMapping.containsKey(name)) {
875+
return modelNameMapping.get(name);
876+
}
877+
873878
// We need to check if schema-mapping has a different model for this class, so we use it
874879
// instead of the auto-generated one.
875880
if (schemaMapping.containsKey(name)) {

0 commit comments

Comments
 (0)