Skip to content

Commit

Permalink
Add operationIdOriginal to store the original operationId (#7522)
Browse files Browse the repository at this point in the history
* add operationIdOriginal to store the original operationId

* store the original operation Id in DefaultCodegen
  • Loading branch information
wing328 committed Feb 1, 2018
1 parent d01a60c commit 13e3db5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -294,6 +295,8 @@ public boolean equals(Object o) {
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;
Expand Down Expand Up @@ -349,6 +352,7 @@ public int hashCode() {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2023,6 +2023,9 @@ public CodegenOperation fromOperation(String path,
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) {
Expand Down

0 comments on commit 13e3db5

Please sign in to comment.