forked from loafle/openapi-generator-original
Issue #1146: do not escape newlines in generated javadocs.
For this, we add a property `unescapedDescription` to CodegenModel + CodegenProperty, and use them for the Javadoc generation, while the annotation uses the escaped `description`.
This commit is contained in:
parent
28579cee03
commit
be84f03d14
@ -10,9 +10,10 @@ import java.util.Set;
|
||||
public class CodegenModel {
|
||||
public String parent;
|
||||
public String name, classname, description, classVarName, modelJson;
|
||||
public String unescapedDescription;
|
||||
public String defaultValue;
|
||||
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>();
|
||||
public Set<String> imports = new HashSet<String>();
|
||||
public Boolean hasVars, emptyVars, hasMoreModels, hasEnums;
|
||||
public ExternalDocs externalDocs;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ public class CodegenProperty {
|
||||
public String baseName, complexType, getter, setter, description, datatype, datatypeWithEnum,
|
||||
name, min, max, defaultValue, baseType, containerType;
|
||||
|
||||
public String unescapedDescription;
|
||||
|
||||
/**
|
||||
* maxLength validation for strings, see http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.2.1
|
||||
*/
|
||||
|
@ -533,6 +533,7 @@ public class DefaultCodegen {
|
||||
m.name = name;
|
||||
}
|
||||
m.description = escapeText(model.getDescription());
|
||||
m.unescapedDescription = model.getDescription();
|
||||
m.classname = toModelName(name);
|
||||
m.classVarName = toVarName(name);
|
||||
m.modelJson = Json.pretty(model);
|
||||
@ -629,6 +630,7 @@ public class DefaultCodegen {
|
||||
property.name = toVarName(name);
|
||||
property.baseName = name;
|
||||
property.description = escapeText(p.getDescription());
|
||||
property.unescapedDescription = p.getDescription();
|
||||
property.getter = "get" + getterAndSetterCapitalize(name);
|
||||
property.setter = "set" + getterAndSetterCapitalize(name);
|
||||
property.example = p.getExample();
|
||||
|
@ -7,10 +7,10 @@ import io.swagger.annotations.*;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
{{#models}}
|
||||
|
||||
{{#model}}{{#description}}
|
||||
{{#model}}{{#unescapedDescription}}
|
||||
/**
|
||||
* {{description}}
|
||||
**/{{/description}}
|
||||
* {{unescapedDescription}}
|
||||
**/{{/unescapedDescription}}
|
||||
@ApiModel(description = "{{{description}}}")
|
||||
{{>generatedAnnotation}}
|
||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
|
||||
@ -22,8 +22,8 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
|
||||
private {{{datatype}}} {{name}} = {{{defaultValue}}};{{/isEnum}}{{/vars}}
|
||||
|
||||
{{#vars}}
|
||||
/**{{#description}}
|
||||
* {{{description}}}{{/description}}{{#minimum}}
|
||||
/**{{#unescapedDescription}}
|
||||
* {{{unescapedDescription}}}{{/unescapedDescription}}{{#minimum}}
|
||||
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
||||
* maximum: {{maximum}}{{/maximum}}
|
||||
**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user