Skip to content

Commit

Permalink
Fix StringIndexOutOfBoundsException when generating example code for …
Browse files Browse the repository at this point in the history
…recursive model (OpenAPITools#15601)

Fixes OpenAPITools#15600
  • Loading branch information
aruiz14 committed Jul 4, 2023
1 parent 4f5738f commit 0bb9088
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ private String constructExampleCode(CodegenModel codegenModel, HashMap<String, C
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 {
Expand Down

0 comments on commit 0bb9088

Please sign in to comment.