Skip to content

Commit

Permalink
fix: support chinese
Browse files Browse the repository at this point in the history
  • Loading branch information
yangqianjun committed Oct 28, 2021
1 parent 6fd3e0a commit a39f1a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CodegenOperation {
isListContainer, isMultipart, hasMore = true,
isResponseBinary = false, isResponseFile = false, hasReference = false,
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
isRestful, isDeprecated, hasOnlyBodyParams = false;
isRestful, isDeprecated, hasOnlyBodyParams, hasNoParams = false;
public String path, testPath, operationId, returnType, httpMethod, returnBaseType,
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse, discriminator;
public List<Map<String, String>> consumes, produces, prioritizedContentTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2435,6 +2435,10 @@ public int compare(CodegenParameter one, CodegenParameter another) {
// only body
op.hasOnlyBodyParams = op.bodyParams.size() > 0 && op.pathParams.size() == 0 && op.queryParams.size() == 0 && op.headerParams.size() == 0 && op.formParams.size() == 0;


// has no params
op.hasNoParams = op.bodyParams.size() == 0 && op.pathParams.size() == 0 && op.queryParams.size() == 0 && op.headerParams.size() == 0 && op.formParams.size() == 0;

// set Restful Flag
op.isRestfulShow = op.isRestfulShow();
op.isRestfulIndex = op.isRestfulIndex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,14 @@ public String toEnumVarName(String name, String datatype) {
return varName;
}

Boolean tmpAllowUnicodeIdentifiers = this.allowUnicodeIdentifiers;
this.allowUnicodeIdentifiers = true;

// string
String enumName = sanitizeName(name);
enumName = enumName.replaceFirst("^_", "");
enumName = enumName.replaceFirst("_$", "");
this.allowUnicodeIdentifiers = tmpAllowUnicodeIdentifiers;

// camelize the enum variable name
// ref: https://basarat.gitbooks.io/typescript/content/docs/enums.html
Expand Down

0 comments on commit a39f1a6

Please sign in to comment.