mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 22:20:56 +00:00
#3285 Check for typeMapper types inside getSwaggerType instead of toModelName
This commit is contained in:
parent
ceffa84cdf
commit
41df857573
@ -1129,11 +1129,6 @@ public class DefaultCodegen {
|
||||
* @return capitalized model name
|
||||
*/
|
||||
public String toModelName(final String name) {
|
||||
// Don't do any kind of renaming to language specific types
|
||||
if(typeMapping.values().contains(name)) {
|
||||
return name;
|
||||
}
|
||||
|
||||
return initialCaps(modelNamePrefix + name + modelNameSuffix);
|
||||
}
|
||||
|
||||
|
@ -343,11 +343,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
|
||||
@Override
|
||||
public String toModelName(final String name) {
|
||||
// Don't do any kind of sanitizing to Java types (e.g. BigDecimal)
|
||||
if(typeMapping.values().contains(name)) {
|
||||
return name;
|
||||
}
|
||||
|
||||
final String sanitizedName = sanitizeName(modelNamePrefix + name + modelNameSuffix);
|
||||
|
||||
// camelize the model name
|
||||
@ -525,21 +520,16 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
@Override
|
||||
public String getSwaggerType(Property p) {
|
||||
String swaggerType = super.getSwaggerType(p);
|
||||
String type;
|
||||
|
||||
// don't apply renaming on types from the typeMapping
|
||||
if (typeMapping.containsKey(swaggerType)) {
|
||||
type = typeMapping.get(swaggerType);
|
||||
if (languageSpecificPrimitives.contains(type) || type.indexOf(".") >= 0 ||
|
||||
type.equals("Map") || type.equals("List") ||
|
||||
type.equals("File") || type.equals("Date")) {
|
||||
return type;
|
||||
}
|
||||
} else {
|
||||
type = swaggerType;
|
||||
return typeMapping.get(swaggerType);
|
||||
}
|
||||
if (null == type) {
|
||||
|
||||
if (null == swaggerType) {
|
||||
LOGGER.error("No Type defined for Property " + p);
|
||||
}
|
||||
return toModelName(type);
|
||||
return toModelName(swaggerType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user