better default value handling in go generators (#9106)

This commit is contained in:
William Cheng 2021-03-30 11:09:21 +08:00 committed by GitHub
parent f66fbf6969
commit f898bfc7d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -788,6 +788,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
@Override @Override
public String toDefaultValue(Schema schema) { public String toDefaultValue(Schema schema) {
schema = ModelUtils.unaliasSchema(this.openAPI, schema);
if (schema.getDefault() != null) { if (schema.getDefault() != null) {
return schema.getDefault().toString(); return schema.getDefault().toString();
} else { } else {