[REQ] Go Server Default values
Created by: langohr
go-server codegen defaultValue is null
We have extended the go-server templates to generate our own specific code. Here we also use the "{{defaultValue}}" in our templates. We found an issue in the file
org/openapitools/codegen/languages/AbstractGoCodegen.java in the method toDefaultValue
Change toDefaultValue method
By comparing then Codegen class with other Codegen classes this code works better for us: org/openapitools/codegen/languages/AbstractGoCodegen.java LINE 727
@Override
public String toDefaultValue(Schema schema) {
if (schema.getDefault() != null) {
return schema.getDefault().toString();
} else {
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
if (schema.getDefault() != null) {
return schema.getDefault().toString();
}
return null;
}
}
Is it possible to change that code?