added escape

This commit is contained in:
Tony Tam 2014-11-10 13:15:27 -08:00
parent 77053fa855
commit 4415cfe30d

View File

@ -40,6 +40,16 @@ public class DefaultCodegen {
return objs; return objs;
} }
// override with any special text escaping logic
public String escapeText(String input) {
if(input != null) {
String output = input.replaceAll("\n", " ");
output = output.replace("\"", "\\\"");
return output;
}
return input;
}
public Set<String> defaultIncludes() { public Set<String> defaultIncludes() {
return defaultIncludes; return defaultIncludes;
} }
@ -418,7 +428,7 @@ public class DefaultCodegen {
property.name = toVarName(name); property.name = toVarName(name);
property.baseName = name; property.baseName = name;
property.description = p.getDescription(); property.description = escapeText(p.getDescription());
property.getter = "get" + initialCaps(name); property.getter = "get" + initialCaps(name);
property.setter = "set" + initialCaps(name); property.setter = "set" + initialCaps(name);
property.example = p.getExample(); property.example = p.getExample();
@ -528,8 +538,8 @@ public class DefaultCodegen {
} }
op.path = path; op.path = path;
op.operationId = operationId; op.operationId = operationId;
op.summary = operation.getSummary(); op.summary = escapeText(operation.getSummary());
op.notes = operation.getDescription(); op.notes = escapeText(operation.getDescription());
op.tags = operation.getTags(); op.tags = operation.getTags();
Response methodResponse = null; Response methodResponse = null;