diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractGoCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractGoCodegen.java index 125a9d6f607..5cc17574166 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractGoCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractGoCodegen.java @@ -332,8 +332,8 @@ public Map postProcessOperations(Map objs) { } } - // import "optionals" package if the parameter is primitive and optional - if (!param.required && param.isPrimitiveType) { + // import "optionals" package if the parameter is optional + if (!param.required) { if (!addedOptionalImport) { imports.add(createMapping("import", "github.com/antihax/optional")); addedOptionalImport = true;