Skip to content

Commit a073391

Browse files
committed
reverted changes on conflict resolve
1 parent 44c4296 commit a073391

File tree

1 file changed

+1
-52
lines changed

1 file changed

+1
-52
lines changed

src/main/java/io/swagger/codegen/v3/generators/kotlin/AbstractKotlinCodegen.java

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegenConfig {
3535
protected String apiDocPath = "docs/";
3636
protected String modelDocPath = "docs/";
3737

38-
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase;
39-
4038
public AbstractKotlinCodegen() {
4139
super();
4240
supportsInheritance = true;
@@ -207,9 +205,6 @@ public AbstractKotlinCodegen() {
207205
addOption(CodegenConstants.GROUP_ID, "Generated artifact package's organization (i.e. maven groupId).", groupId);
208206
addOption(CodegenConstants.ARTIFACT_ID, "Generated artifact id (name of jar).", artifactId);
209207
addOption(CodegenConstants.ARTIFACT_VERSION, "Generated artifact's package version.", artifactVersion);
210-
211-
CliOption enumPropertyNamingOpt = new CliOption(CodegenConstants.ENUM_PROPERTY_NAMING, CodegenConstants.ENUM_PROPERTY_NAMING_DESC);
212-
cliOptions.add(enumPropertyNamingOpt.defaultValue(enumPropertyNaming.name()));
213208
}
214209

215210
protected void addOption(String key, String description) {
@@ -260,27 +255,6 @@ public String escapeUnsafeCharacters(String input) {
260255
return input.replace("*/", "*_/").replace("/*", "/_*");
261256
}
262257

263-
public CodegenConstants.ENUM_PROPERTY_NAMING_TYPE getEnumPropertyNaming() {
264-
return this.enumPropertyNaming;
265-
}
266-
267-
/**
268-
* Sets the naming convention for Kotlin enum properties
269-
*
270-
* @param enumPropertyNamingType The string representation of the naming convention, as defined by {@link CodegenConstants.ENUM_PROPERTY_NAMING_TYPE}
271-
*/
272-
public void setEnumPropertyNaming(final String enumPropertyNamingType) {
273-
try {
274-
this.enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.valueOf(enumPropertyNamingType);
275-
} catch (IllegalArgumentException ex) {
276-
StringBuilder sb = new StringBuilder(enumPropertyNamingType + " is an invalid enum property naming option. Please choose from:");
277-
for (CodegenConstants.ENUM_PROPERTY_NAMING_TYPE t : CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.values()) {
278-
sb.append("\n ").append(t.name());
279-
}
280-
throw new RuntimeException(sb.toString());
281-
}
282-
}
283-
284258
protected void updateCodegenModelEnumVars(CodegenModel codegenModel) {
285259
super.updateCodegenModelEnumVars(codegenModel);
286260
for (CodegenProperty var : codegenModel.allVars) {
@@ -361,10 +335,6 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) {
361335
public void processOpts() {
362336
super.processOpts();
363337

364-
if (additionalProperties.containsKey(CodegenConstants.ENUM_PROPERTY_NAMING)) {
365-
setEnumPropertyNaming((String) additionalProperties.get(CodegenConstants.ENUM_PROPERTY_NAMING));
366-
}
367-
368338
if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) {
369339
this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
370340
} else {
@@ -447,28 +417,7 @@ public String toEnumVarName(String value, String datatype) {
447417
modified = sanitizeKotlinSpecificNames(modified);
448418
}
449419

450-
switch (getEnumPropertyNaming()) {
451-
case original:
452-
// NOTE: This is provided as a last-case allowance, but will still result in reserved words being escaped.
453-
modified = value;
454-
break;
455-
case camelCase:
456-
// NOTE: Removes hyphens and underscores
457-
modified = camelize(modified, true);
458-
break;
459-
case PascalCase:
460-
// NOTE: Removes hyphens and underscores
461-
String result = camelize(modified);
462-
modified = titleCase(result);
463-
break;
464-
case snake_case:
465-
// NOTE: Removes hyphens
466-
modified = underscore(modified);
467-
break;
468-
case UPPERCASE:
469-
modified = modified.toUpperCase();
470-
break;
471-
}
420+
modified = modified.toUpperCase();
472421

473422
if (isReservedWord(modified)) {
474423
return escapeReservedWord(modified);

0 commit comments

Comments
 (0)