set example when defined

This commit is contained in:
Tony Tam 2016-02-10 15:25:51 -08:00
parent 3282c1f325
commit cb196eb351
2 changed files with 12 additions and 2 deletions

View File

@ -593,6 +593,9 @@ public class DefaultCodegen {
*/
@SuppressWarnings("static-method")
public String toExampleValue(Property p) {
if(p.getExample() != null) {
return p.getExample().toString();
}
if (p instanceof StringProperty) {
return "null";
} else if (p instanceof BooleanProperty) {

View File

@ -63,8 +63,15 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen
}
@Override
public void processOpts()
{
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
super.postProcessModelProperty(model, property);
if("null".equals(property.example)) {
property.example = null;
}
}
@Override
public void processOpts() {
super.processOpts();
if ( additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER) ) {