mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 06:30:52 +00:00
[csharp] Fix interfacePrefix sensitivity + default (#4561)
After merging the fix with another C# change, noticed case sensitivity issue for the true/false checks. Also noticed my original implementation wasn't setting the default I- prefix as intended. This commit resolves those three issues.
This commit is contained in:
parent
2d8715f42c
commit
23c5376ed6
@ -259,15 +259,16 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
|
|
||||||
if (additionalProperties.containsKey(CodegenConstants.INTERFACE_PREFIX)) {
|
if (additionalProperties.containsKey(CodegenConstants.INTERFACE_PREFIX)) {
|
||||||
String useInterfacePrefix = additionalProperties.get(CodegenConstants.INTERFACE_PREFIX).toString();
|
String useInterfacePrefix = additionalProperties.get(CodegenConstants.INTERFACE_PREFIX).toString();
|
||||||
if("false".equals(useInterfacePrefix)) {
|
if("false".equals(useInterfacePrefix.toLowerCase())) {
|
||||||
setInterfacePrefix("");
|
setInterfacePrefix("");
|
||||||
} else if(!"true".equals(useInterfacePrefix)) {
|
} else if(!"true".equals(useInterfacePrefix.toLowerCase())) {
|
||||||
// NOTE: if user passes "true" explicitly, we use the default I- prefix. The other supported case here is a custom prefix.
|
// NOTE: if user passes "true" explicitly, we use the default I- prefix. The other supported case here is a custom prefix.
|
||||||
setInterfacePrefix(sanitizeName(useInterfacePrefix));
|
setInterfacePrefix(sanitizeName(useInterfacePrefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
additionalProperties.put(CodegenConstants.INTERFACE_PREFIX, interfacePrefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This either updates additionalProperties with the above fixes, or sets the default if the option was not specified.
|
||||||
|
additionalProperties.put(CodegenConstants.INTERFACE_PREFIX, interfacePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user