Skip to content

Commit 13e3db5

Browse files
authored
Add operationIdOriginal to store the original operationId (#7522)
* add operationIdOriginal to store the original operationId * store the original operation Id in DefaultCodegen
1 parent d01a60c commit 13e3db5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class CodegenOperation {
3838
public ExternalDocs externalDocs;
3939
public Map<String, Object> vendorExtensions;
4040
public String nickname; // legacy support
41+
public String operationIdOriginal; // for plug-in
4142
public String operationIdLowerCase; // for markdown documentation
4243
public String operationIdCamelCase; // for class names
4344
public String operationIdSnakeCase;
@@ -294,6 +295,8 @@ public boolean equals(Object o) {
294295
return false;
295296
if ( prioritizedContentTypes != null ? !prioritizedContentTypes.equals(that.prioritizedContentTypes) : that.prioritizedContentTypes != null )
296297
return false;
298+
if ( operationIdOriginal != null ? !operationIdOriginal.equals(that.operationIdOriginal) : that.operationIdOriginal != null )
299+
return false;
297300
if ( operationIdLowerCase != null ? !operationIdLowerCase.equals(that.operationIdLowerCase) : that.operationIdLowerCase != null )
298301
return false;
299302
return operationIdCamelCase != null ? operationIdCamelCase.equals(that.operationIdCamelCase) : that.operationIdCamelCase == null;
@@ -349,6 +352,7 @@ public int hashCode() {
349352
result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0);
350353
result = 31 * result + (nickname != null ? nickname.hashCode() : 0);
351354
result = 31 * result + (prioritizedContentTypes != null ? prioritizedContentTypes.hashCode() : 0);
355+
result = 31 * result + (operationIdOriginal != null ? operationIdOriginal.hashCode() : 0);
352356
result = 31 * result + (operationIdLowerCase != null ? operationIdLowerCase.hashCode() : 0);
353357
result = 31 * result + (operationIdCamelCase != null ? operationIdCamelCase.hashCode() : 0);
354358
return result;

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,6 +2023,9 @@ public CodegenOperation fromOperation(String path,
20232023
Set<String> imports = new HashSet<String>();
20242024
op.vendorExtensions = operation.getVendorExtensions();
20252025

2026+
// store the original operationId for plug-in
2027+
op.operationIdOriginal = operation.getOperationId();
2028+
20262029
String operationId = getOrGenerateOperationId(operation, path, httpMethod);
20272030
// remove prefix in operationId
20282031
if (removeOperationIdPrefix) {

0 commit comments

Comments
 (0)