fix(java): Use modelNameMappings if provided (#18025)

This commit is contained in:
Daniel Seiler 2024-03-06 06:57:03 +01:00 committed by GitHub
parent ae9084bfd6
commit 8eaeb2a1e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -870,6 +870,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
@Override
public String toModelName(final String name) {
// obtain the name from modelNameMapping directly if provided
if (modelNameMapping.containsKey(name)) {
return modelNameMapping.get(name);
}
// We need to check if schema-mapping has a different model for this class, so we use it
// instead of the auto-generated one.
if (schemaMapping.containsKey(name)) {