mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 18:45:23 +00:00
Swagr Codegen: Updates to generate comments properly for models
This commit is contained in:
parent
1f738486ee
commit
b61d3b2914
@ -15,17 +15,19 @@ import $import$;
|
||||
*/
|
||||
public class $className$ extends $extends$ {
|
||||
|
||||
$fields:{ field |
|
||||
//$field.description$
|
||||
private $field.fieldDefinition.returnType$ $field.fieldDefinition.name$ $field.fieldDefinition.initialization$;
|
||||
}$
|
||||
|
||||
$fields:{ field |
|
||||
//$field.description$
|
||||
$if(field.required)$
|
||||
@Required $endif$
|
||||
$if(field.allowableValues)$
|
||||
@AllowableValues(value="$field.allowableValues$")$endif$
|
||||
$fields:{ field |
|
||||
|
||||
/**
|
||||
* $field.description$
|
||||
*/
|
||||
private $field.fieldDefinition.returnType$ $field.fieldDefinition.name$ $field.fieldDefinition.initialization$;$\r$}$
|
||||
|
||||
$fields:{ field |
|
||||
/**
|
||||
* $field.description$
|
||||
* $if(field.required)$@Required$endif$
|
||||
* $if(field.allowableValues)$@AllowableValues(value="$field.allowedValuesString$")$endif$
|
||||
*/
|
||||
public $field.fieldDefinition.returnType$ get$field.fieldDefinition.NameForMethod$() {
|
||||
return $field.fieldDefinition.name$;
|
||||
}
|
||||
@ -33,5 +35,6 @@ public class $className$ extends $extends$ {
|
||||
public void set$field.fieldDefinition.NameForMethod$($field.fieldDefinition.returnType$ $field.fieldDefinition.name$) {
|
||||
this.$field.fieldDefinition.name$ = $field.fieldDefinition.name$;
|
||||
}
|
||||
}$
|
||||
|
||||
}$
|
||||
}
|
@ -96,8 +96,10 @@ public class ModelField {
|
||||
|
||||
public String getAllowedValuesString() {
|
||||
String result = "";
|
||||
for(String allowedValue: this.allowableValues){
|
||||
result += (allowedValue +",");
|
||||
if (this.allowableValues != null) {
|
||||
for(String allowedValue: this.allowableValues){
|
||||
result += (allowedValue +",");
|
||||
}
|
||||
}
|
||||
if(result.length() == 0)
|
||||
return null;
|
||||
|
@ -15,17 +15,19 @@ import $import$;
|
||||
*/
|
||||
public class $className$ extends $extends$ {
|
||||
|
||||
$fields:{ field |
|
||||
//$field.description$
|
||||
private $field.fieldDefinition.returnType$ $field.fieldDefinition.name$ $field.fieldDefinition.initialization$;
|
||||
}$
|
||||
$fields:{ field |
|
||||
/**
|
||||
* $field.description$
|
||||
*/
|
||||
private $field.fieldDefinition.returnType$ $field.fieldDefinition.name$ $field.fieldDefinition.initialization$;$\n$
|
||||
}$
|
||||
|
||||
$fields:{ field |
|
||||
//$field.description$
|
||||
$if(field.required)$
|
||||
@Required $endif$
|
||||
$if(field.allowableValues)$
|
||||
@AllowableValues(value="$field.allowableValues$")$endif$
|
||||
$fields:{ field |
|
||||
/**
|
||||
* $field.description$
|
||||
* $if(field.required)$@Required$endif$
|
||||
* $if(field.allowedValuesString)$@AllowableValues(value="$field.allowableValues$")$endif$
|
||||
*/
|
||||
public $field.fieldDefinition.returnType$ get$field.fieldDefinition.NameForMethod$() {
|
||||
return $field.fieldDefinition.name$;
|
||||
}
|
||||
@ -33,5 +35,5 @@ public class $className$ extends $extends$ {
|
||||
public void set$field.fieldDefinition.NameForMethod$($field.fieldDefinition.returnType$ $field.fieldDefinition.name$) {
|
||||
this.$field.fieldDefinition.name$ = $field.fieldDefinition.name$;
|
||||
}
|
||||
}$
|
||||
}$
|
||||
}
|
Loading…
Reference in New Issue
Block a user