Skip to content

Commit d2faa63

Browse files
committed
Merge pull request #1431 from wing328/fix_empty_operation_id
Better error message for empty operationId
2 parents fecbc3c + dd34d75 commit d2faa63

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
@@ -604,7 +604,8 @@ public void processOperation(String resourcePath, String httpMethod, Operation o
604604
+ " Tag: " + tag + "\n"//
605605
+ " Operation: " + operation.getOperationId() + "\n" //
606606
+ " Resource: " + httpMethod + " " + resourcePath + "\n"//
607-
+ " Definitions: " + swagger.getDefinitions();
607+
+ " Definitions: " + swagger.getDefinitions() + "\n" //
608+
+ " Exception: " + ex.getMessage();
608609
throw new RuntimeException(msg, ex);
609610
}
610611
}

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)