File tree Expand file tree Collapse file tree 3 files changed +28
-8
lines changed
java/io/swagger/codegen/v3/generators/go Expand file tree Collapse file tree 3 files changed +28
-8
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public AbstractGoCodegen() {
92
92
typeMapping .put ("file" , "*os.File" );
93
93
// map binary to string as a workaround
94
94
// the correct solution is to use []byte
95
- typeMapping .put ("binary" , "string " );
95
+ typeMapping .put ("binary" , "*os.File " );
96
96
typeMapping .put ("ByteArray" , "string" );
97
97
typeMapping .put ("object" , "interface{}" );
98
98
typeMapping .put ("UUID" , "string" );
@@ -255,7 +255,7 @@ public String getTypeDeclaration(Schema schema) {
255
255
} else {
256
256
prefix = SchemaHandler .ANY_OF_PREFFIX ;
257
257
}
258
- return "[]" + toModelName (prefix + schema .getExtensions ().get ("x-schema-name" )) + SchemaHandler .ARRAY_ITEMS_SUFFIX ;
258
+ return "[]" + toModelName (prefix + schema .getExtensions ().remove ("x-schema-name" )) + SchemaHandler .ARRAY_ITEMS_SUFFIX ;
259
259
} else {
260
260
return "[]" + getTypeDeclaration (inner );
261
261
}
Original file line number Diff line number Diff line change @@ -34,8 +34,22 @@ type {{classname}}Service service
34
34
*/
35
35
{ {#hasOptionalParams} }
36
36
37
- type { {{classname} }}{ {{nickname} }}Opts struct { {{#parameters} }{ {^required} }
38
- { {#isPrimitiveType} } { {vendorExtensions.x-exportParamName} } optional.{ {vendorExtensions.x-optionalDataType} }{ {/isPrimitiveType} }{ {^isPrimitiveType} } { {vendorExtensions.x-exportParamName} } optional.Interface{ {/isPrimitiveType} }{ {/required} }{ {/parameters} }
37
+ type { {{classname} }}{ {{nickname} }}Opts struct {
38
+ {{#parameters} }
39
+ { {^required} }
40
+ { {#isPrimitiveType} }
41
+ { {#isFile} }
42
+ { {vendorExtensions.x-exportParamName} } optional.Interface
43
+ { {/isFile} }
44
+ { {^isFile} }
45
+ { {vendorExtensions.x-exportParamName} } optional.{ {vendorExtensions.x-optionalDataType} }
46
+ { {/isFile} }
47
+ { {/isPrimitiveType} }
48
+ { {^isPrimitiveType} }
49
+ { {vendorExtensions.x-exportParamName} } optional.Interface
50
+ { {/isPrimitiveType} }
51
+ { {/required} }
52
+ { {/parameters} }
39
53
}
40
54
41
55
{ {/hasOptionalParams} }
Original file line number Diff line number Diff line change 1
1
{ {> partial_header} }
2
2
package { {packageName} }
3
- { {#models} }{ {#imports} }
4
- import ({ {/imports} }{ {#imports} }
5
- "{ {import} }"{ {/imports} }{ {#imports} }
3
+ { {#models} }
4
+ { {#imports} }
5
+ { {#@first} }
6
+ import (
7
+ { {/@first} }
8
+ "{ {import} }"
9
+ { {#@last} }
6
10
)
7
- { {/imports} }{ {#model} }{ {#isEnum} }{ {#description} }// { {{classname} }} : { {{description} }}{ {/description} }
11
+ { {/@last} }
12
+ { {/imports} }
13
+ { {#model} }{ {#isEnum} }{ {#description} }// { {{classname} }} : { {{description} }}{ {/description} }
8
14
type { {{classname} }} { {^format} }{ {dataType} }{ {/format} }{ {#format} }{ {{format} }}{ {/format} }
9
15
10
16
// List of { {{name} }}
You can’t perform that action at this time.
0 commit comments