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,6 +5,6 @@ import (
 | 
			
		||||
 | 
			
		||||
type ApiResponse struct {
 | 
			
		||||
    Code  int32  `json:"code,omitempty"`
 | 
			
		||||
Type_  string  `json:"type,omitempty"`
 | 
			
		||||
Message  string  `json:"message,omitempty"`
 | 
			
		||||
    Type_  string  `json:"type,omitempty"`
 | 
			
		||||
    Message  string  `json:"message,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,5 +5,5 @@ import (
 | 
			
		||||
 | 
			
		||||
type Category struct {
 | 
			
		||||
    Id  int64  `json:"id,omitempty"`
 | 
			
		||||
Name  string  `json:"name,omitempty"`
 | 
			
		||||
    Name  string  `json:"name,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -6,9 +6,9 @@ import (
 | 
			
		||||
 | 
			
		||||
type Order struct {
 | 
			
		||||
    Id  int64  `json:"id,omitempty"`
 | 
			
		||||
PetId  int64  `json:"petId,omitempty"`
 | 
			
		||||
Quantity  int32  `json:"quantity,omitempty"`
 | 
			
		||||
ShipDate  time.Time  `json:"shipDate,omitempty"`
 | 
			
		||||
Status  string  `json:"status,omitempty"`
 | 
			
		||||
Complete  bool  `json:"complete,omitempty"`
 | 
			
		||||
    PetId  int64  `json:"petId,omitempty"`
 | 
			
		||||
    Quantity  int32  `json:"quantity,omitempty"`
 | 
			
		||||
    ShipDate  time.Time  `json:"shipDate,omitempty"`
 | 
			
		||||
    Status  string  `json:"status,omitempty"`
 | 
			
		||||
    Complete  bool  `json:"complete,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,9 +5,9 @@ import (
 | 
			
		||||
 | 
			
		||||
type Pet struct {
 | 
			
		||||
    Id  int64  `json:"id,omitempty"`
 | 
			
		||||
Category  Category  `json:"category,omitempty"`
 | 
			
		||||
Name  string  `json:"name,omitempty"`
 | 
			
		||||
PhotoUrls  []string  `json:"photoUrls,omitempty"`
 | 
			
		||||
Tags  []Tag  `json:"tags,omitempty"`
 | 
			
		||||
Status  string  `json:"status,omitempty"`
 | 
			
		||||
    Category  Category  `json:"category,omitempty"`
 | 
			
		||||
    Name  string  `json:"name,omitempty"`
 | 
			
		||||
    PhotoUrls  []string  `json:"photoUrls,omitempty"`
 | 
			
		||||
    Tags  []Tag  `json:"tags,omitempty"`
 | 
			
		||||
    Status  string  `json:"status,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,5 +5,5 @@ import (
 | 
			
		||||
 | 
			
		||||
type Tag struct {
 | 
			
		||||
    Id  int64  `json:"id,omitempty"`
 | 
			
		||||
Name  string  `json:"name,omitempty"`
 | 
			
		||||
    Name  string  `json:"name,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,11 +5,11 @@ import (
 | 
			
		||||
 | 
			
		||||
type User struct {
 | 
			
		||||
    Id  int64  `json:"id,omitempty"`
 | 
			
		||||
Username  string  `json:"username,omitempty"`
 | 
			
		||||
FirstName  string  `json:"firstName,omitempty"`
 | 
			
		||||
LastName  string  `json:"lastName,omitempty"`
 | 
			
		||||
Email  string  `json:"email,omitempty"`
 | 
			
		||||
Password  string  `json:"password,omitempty"`
 | 
			
		||||
Phone  string  `json:"phone,omitempty"`
 | 
			
		||||
UserStatus  int32  `json:"userStatus,omitempty"`
 | 
			
		||||
    Username  string  `json:"username,omitempty"`
 | 
			
		||||
    FirstName  string  `json:"firstName,omitempty"`
 | 
			
		||||
    LastName  string  `json:"lastName,omitempty"`
 | 
			
		||||
    Email  string  `json:"email,omitempty"`
 | 
			
		||||
    Password  string  `json:"password,omitempty"`
 | 
			
		||||
    Phone  string  `json:"phone,omitempty"`
 | 
			
		||||
    UserStatus  int32  `json:"userStatus,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user