Merge pull request #1431 from wing328/fix_empty_operation_id

Better error message for empty operationId
This commit is contained in:
wing328 2015-10-23 18:47:04 +08:00
commit d2faa63ebc
2 changed files with 3 additions and 2 deletions

View File

@ -604,7 +604,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
+ " Tag: " + tag + "\n"//
+ " Operation: " + operation.getOperationId() + "\n" //
+ " Resource: " + httpMethod + " " + resourcePath + "\n"//
+ " Definitions: " + swagger.getDefinitions();
+ " Definitions: " + swagger.getDefinitions() + "\n" //
+ " Exception: " + ex.getMessage();
throw new RuntimeException(msg, ex);
}
}

View File

@ -378,7 +378,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
public String toOperationId(String operationId) {
// throw exception if method name is empty
if (StringUtils.isEmpty(operationId)) {
throw new RuntimeException("Empty method name (operationId) not allowed");
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
}
// method name cannot use reserved keyword, e.g. return