Skip to content

Commit d46704c

Browse files
committed
identified no objects schema as alias to skip generation for primitive types and collections
1 parent a94f179 commit d46704c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/main/java/io/swagger/codegen/v3/generators/go/AbstractGoCodegen.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,4 +530,20 @@ public String toEnumName(CodegenProperty property) {
530530
public void setWithXml(boolean withXml) {
531531
this.withXml = withXml;
532532
}
533+
534+
@Override
535+
public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> allDefinitions) {
536+
final CodegenModel codegenModel = super.fromModel(name, schema, allDefinitions);
537+
if (!getBooleanValue(codegenModel, CodegenConstants.IS_ALIAS_EXT_NAME)) {
538+
boolean isAlias = schema instanceof ArraySchema
539+
|| schema instanceof MapSchema
540+
|| (!isObjectSchema(schema));
541+
542+
codegenModel.getVendorExtensions().put(CodegenConstants.IS_ALIAS_EXT_NAME, isAlias);
543+
}
544+
545+
546+
547+
return codegenModel;
548+
}
533549
}

0 commit comments

Comments
 (0)