Skip to content

Commit 80259fb

Browse files
committed
Fixed the compile time error in the generated code caused due to unescaped new line characters.
Since the description text is not being escaped, if there is a new line character, it will cause a new line to be added to the source code. This can cause compile time error if the new line character is part of a string (e.g. java string) and there is no '+' sign explicitly added to the code. Note: The code was doing escapeText for properties but not for models. This patch fixes that.
1 parent 64292cd commit 80259fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/DefaultCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ public CodegenModel fromModel(String name, Model model) {
406406
m.name = escapeReservedWord(name);
407407
else
408408
m.name = name;
409-
m.description = model.getDescription();
409+
m.description = escapeText(model.getDescription());
410410
m.classname = toModelName(name);
411411
m.classVarName = toVarName(name);
412412
m.modelJson = Json.pretty(model);

0 commit comments

Comments
 (0)