Add operationIdOriginal to store the original operationId (#7522)

* add operationIdOriginal to store the original operationId

* store the original operation Id in DefaultCodegen
This commit is contained in:
William Cheng 2018-02-01 19:25:25 +08:00 committed by GitHub
parent d01a60cb14
commit 13e3db59e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -38,6 +38,7 @@ public class CodegenOperation {
public ExternalDocs externalDocs;
public Map<String, Object> vendorExtensions;
public String nickname; // legacy support
public String operationIdOriginal; // for plug-in
public String operationIdLowerCase; // for markdown documentation
public String operationIdCamelCase; // for class names
public String operationIdSnakeCase;
@ -294,6 +295,8 @@ public class CodegenOperation {
return false;
if ( prioritizedContentTypes != null ? !prioritizedContentTypes.equals(that.prioritizedContentTypes) : that.prioritizedContentTypes != null )
return false;
if ( operationIdOriginal != null ? !operationIdOriginal.equals(that.operationIdOriginal) : that.operationIdOriginal != null )
return false;
if ( operationIdLowerCase != null ? !operationIdLowerCase.equals(that.operationIdLowerCase) : that.operationIdLowerCase != null )
return false;
return operationIdCamelCase != null ? operationIdCamelCase.equals(that.operationIdCamelCase) : that.operationIdCamelCase == null;
@ -349,6 +352,7 @@ public class CodegenOperation {
result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0);
result = 31 * result + (nickname != null ? nickname.hashCode() : 0);
result = 31 * result + (prioritizedContentTypes != null ? prioritizedContentTypes.hashCode() : 0);
result = 31 * result + (operationIdOriginal != null ? operationIdOriginal.hashCode() : 0);
result = 31 * result + (operationIdLowerCase != null ? operationIdLowerCase.hashCode() : 0);
result = 31 * result + (operationIdCamelCase != null ? operationIdCamelCase.hashCode() : 0);
return result;

View File

@ -2023,6 +2023,9 @@ public class DefaultCodegen {
Set<String> imports = new HashSet<String>();
op.vendorExtensions = operation.getVendorExtensions();
// store the original operationId for plug-in
op.operationIdOriginal = operation.getOperationId();
String operationId = getOrGenerateOperationId(operation, path, httpMethod);
// remove prefix in operationId
if (removeOperationIdPrefix) {