Fix StringIndexOutOfBoundsException when generating example code for recursive model (#15601)

Fixes #15600
This commit is contained in:
Alejandro Ruiz
2023-07-04 17:27:30 +02:00
committed by GitHub
parent 4f5738f493
commit 0bb9088f3e

View File

@@ -695,7 +695,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
if (modelMaps.get(subModel) == null) {
oneOf = "new(" + subModel + ")";// a primitive type
} else {
oneOf = constructExampleCode(modelMaps.get(subModel), modelMaps, processedModelMap, depth + 1).substring(1);
oneOf = StringUtils.removeStart(constructExampleCode(modelMaps.get(subModel), modelMaps, processedModelMap, depth + 1), "*");
}
return goImportAlias + "." + model + "{" + typeToName(subModel) + ": " + oneOf + "}";
} else {