Skip to content

Commit dd34d75

Browse files
committed
better error message for empty operationId
1 parent 0f75b05 commit dd34d75

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,8 @@ public void processOperation(String resourcePath, String httpMethod, Operation o
531531
+ " Tag: " + tag + "\n"//
532532
+ " Operation: " + operation.getOperationId() + "\n" //
533533
+ " Resource: " + httpMethod + " " + resourcePath + "\n"//
534-
+ " Definitions: " + swagger.getDefinitions();
534+
+ " Definitions: " + swagger.getDefinitions() + "\n" //
535+
+ " Exception: " + ex.getMessage();
535536
throw new RuntimeException(msg, ex);
536537
}
537538
}

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ public String getSwaggerType(Property p) {
378378
public String toOperationId(String operationId) {
379379
// throw exception if method name is empty
380380
if (StringUtils.isEmpty(operationId)) {
381-
throw new RuntimeException("Empty method name (operationId) not allowed");
381+
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
382382
}
383383

384384
// method name cannot use reserved keyword, e.g. return

0 commit comments

Comments
 (0)