forked from loafle/openapi-generator-original
udpate type mapping for go, fix indention in go model
This commit is contained in:
parent
87af119d9a
commit
d8963d0a85
@ -79,11 +79,12 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.clear();
|
||||
typeMapping.put("integer", "int32");
|
||||
typeMapping.put("long", "int64");
|
||||
typeMapping.put("number", "float32");
|
||||
typeMapping.put("float", "float32");
|
||||
typeMapping.put("double", "float64");
|
||||
typeMapping.put("boolean", "bool");
|
||||
typeMapping.put("string", "string");
|
||||
typeMapping.put("Date", "time.Time");
|
||||
typeMapping.put("date", "time.Time");
|
||||
typeMapping.put("DateTime", "time.Time");
|
||||
typeMapping.put("password", "string");
|
||||
typeMapping.put("File", "*os.File");
|
||||
@ -91,6 +92,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
// map binary to string as a workaround
|
||||
// the correct solution is to use []byte
|
||||
typeMapping.put("binary", "string");
|
||||
typeMapping.put("ByteArray", "string");
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
importMapping.put("time.Time", "time");
|
||||
|
@ -8,7 +8,8 @@ import (
|
||||
|
||||
{{#model}}
|
||||
type {{classname}} struct {
|
||||
{{#vars}}{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
|
||||
{{#vars}}
|
||||
{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
|
||||
{{/vars}}
|
||||
}
|
||||
{{/model}}
|
||||
|
@ -1427,7 +1427,7 @@
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"dateTime" : {
|
||||
"password" : {
|
||||
"type": "string",
|
||||
"format": "password"
|
||||
}
|
||||
|
@ -5,5 +5,4 @@ import (
|
||||
|
||||
type ModelReturn struct {
|
||||
Return_ int32 `json:"return,omitempty"`
|
||||
|
||||
}
|
||||
|
@ -5,5 +5,5 @@ import (
|
||||
|
||||
type Name struct {
|
||||
Name int32 `json:"name,omitempty"`
|
||||
|
||||
SnakeCase int32 `json:"snake_case,omitempty"`
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user