Add check for rest path curly braces
When rest request path set a missing curly braces
for example a value should be '{l3-networkUuid}' but
actually '{l3-networkUuid' which will cause no api
mapping error when invoke rest API
@@ -331,10 +331,20 @@ ${generateMethods(path)}
return ret
} else {
- if (requestAnnotation.path() == "null") {
+ def requestPath = requestAnnotation.path()
+ if (requestPath == "null") {
throw new CloudRuntimeException("'path' is set to 'null' but no @SDK found on the class[${apiMessageClass.name}]")
}
+ if (requestPath.contains("{") || requestPath.contains("}")) {
+ def pattern = ~/\{([^}]*)}/
+ requestPath = requestPath.replaceAll(pattern, "")
+
+ if (requestPath.contains("{") || requestPath.contains("}")) {
+ throw new CloudRuntimeException("'path' value format is missing please check '{' and '}' in path on the class[${apiMessageClass.name}]")
+ }
+ }
+
return [generateAction(generateClassName(), requestAnnotation.path())]
}
}
