forked from loafle/openapi-generator-original
Merge pull request #2562 from guohuang/issue2548
issue #2548, added docstring to Go model and its properties
This commit is contained in:
commit
fb8c001075
@ -7,8 +7,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
{{#model}}
|
{{#model}}
|
||||||
|
{{#description}}// {{{description}}}{{/description}}
|
||||||
type {{classname}} struct {
|
type {{classname}} struct {
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
|
{{#description}}// {{{description}}}{{/description}}
|
||||||
{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
|
{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,12 @@ package swagger
|
|||||||
import (
|
import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type ApiResponse struct {
|
type ApiResponse struct {
|
||||||
|
|
||||||
Code int32 `json:"code,omitempty"`
|
Code int32 `json:"code,omitempty"`
|
||||||
|
|
||||||
Type_ string `json:"type,omitempty"`
|
Type_ string `json:"type,omitempty"`
|
||||||
|
|
||||||
Message string `json:"message,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,10 @@ package swagger
|
|||||||
import (
|
import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type Category struct {
|
type Category struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,18 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type Order struct {
|
type Order struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
|
||||||
PetId int64 `json:"petId,omitempty"`
|
PetId int64 `json:"petId,omitempty"`
|
||||||
|
|
||||||
Quantity int32 `json:"quantity,omitempty"`
|
Quantity int32 `json:"quantity,omitempty"`
|
||||||
|
|
||||||
ShipDate time.Time `json:"shipDate,omitempty"`
|
ShipDate time.Time `json:"shipDate,omitempty"`
|
||||||
|
// Order Status
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"`
|
||||||
|
|
||||||
Complete bool `json:"complete,omitempty"`
|
Complete bool `json:"complete,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,18 @@ package swagger
|
|||||||
import (
|
import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type Pet struct {
|
type Pet struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
|
||||||
Category Category `json:"category,omitempty"`
|
Category Category `json:"category,omitempty"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
|
|
||||||
PhotoUrls []string `json:"photoUrls,omitempty"`
|
PhotoUrls []string `json:"photoUrls,omitempty"`
|
||||||
|
|
||||||
Tags []Tag `json:"tags,omitempty"`
|
Tags []Tag `json:"tags,omitempty"`
|
||||||
|
// pet status in the store
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,10 @@ package swagger
|
|||||||
import (
|
import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type Tag struct {
|
type Tag struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,22 @@ package swagger
|
|||||||
import (
|
import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
|
||||||
Username string `json:"username,omitempty"`
|
Username string `json:"username,omitempty"`
|
||||||
|
|
||||||
FirstName string `json:"firstName,omitempty"`
|
FirstName string `json:"firstName,omitempty"`
|
||||||
|
|
||||||
LastName string `json:"lastName,omitempty"`
|
LastName string `json:"lastName,omitempty"`
|
||||||
|
|
||||||
Email string `json:"email,omitempty"`
|
Email string `json:"email,omitempty"`
|
||||||
|
|
||||||
Password string `json:"password,omitempty"`
|
Password string `json:"password,omitempty"`
|
||||||
|
|
||||||
Phone string `json:"phone,omitempty"`
|
Phone string `json:"phone,omitempty"`
|
||||||
|
// User Status
|
||||||
UserStatus int32 `json:"userStatus,omitempty"`
|
UserStatus int32 `json:"userStatus,omitempty"`
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user