From 9c455880b21dcb5ea48263751cd6c0c430a23c7b Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Mon, 11 Apr 2016 11:14:33 -0700 Subject: [PATCH] issue #2548, added docstring to Go model and its properties --- .../swagger-codegen/src/main/resources/go/model.mustache | 2 ++ samples/client/petstore/go/swagger/ApiResponse.go | 4 ++++ samples/client/petstore/go/swagger/Category.go | 3 +++ samples/client/petstore/go/swagger/Order.go | 7 +++++++ samples/client/petstore/go/swagger/Pet.go | 7 +++++++ samples/client/petstore/go/swagger/Tag.go | 3 +++ samples/client/petstore/go/swagger/User.go | 9 +++++++++ 7 files changed, 35 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/go/model.mustache b/modules/swagger-codegen/src/main/resources/go/model.mustache index 9045bea1ed2..4102299c5e9 100644 --- a/modules/swagger-codegen/src/main/resources/go/model.mustache +++ b/modules/swagger-codegen/src/main/resources/go/model.mustache @@ -7,8 +7,10 @@ import ( ) {{#model}} +{{#description}}// {{{description}}}{{/description}} type {{classname}} struct { {{#vars}} + {{#description}}// {{{description}}}{{/description}} {{name}} {{{datatype}}} `json:"{{baseName}},omitempty"` {{/vars}} } diff --git a/samples/client/petstore/go/swagger/ApiResponse.go b/samples/client/petstore/go/swagger/ApiResponse.go index 196af29c15d..abb7971189d 100644 --- a/samples/client/petstore/go/swagger/ApiResponse.go +++ b/samples/client/petstore/go/swagger/ApiResponse.go @@ -3,8 +3,12 @@ package swagger import ( ) + type ApiResponse struct { + Code int32 `json:"code,omitempty"` + Type_ string `json:"type,omitempty"` + Message string `json:"message,omitempty"` } diff --git a/samples/client/petstore/go/swagger/Category.go b/samples/client/petstore/go/swagger/Category.go index 1739a41f1eb..1853dfe7239 100644 --- a/samples/client/petstore/go/swagger/Category.go +++ b/samples/client/petstore/go/swagger/Category.go @@ -3,7 +3,10 @@ package swagger import ( ) + type Category struct { + Id int64 `json:"id,omitempty"` + Name string `json:"name,omitempty"` } diff --git a/samples/client/petstore/go/swagger/Order.go b/samples/client/petstore/go/swagger/Order.go index 8b9ddfeb212..a199bcc857d 100644 --- a/samples/client/petstore/go/swagger/Order.go +++ b/samples/client/petstore/go/swagger/Order.go @@ -4,11 +4,18 @@ import ( "time" ) + type Order struct { + Id int64 `json:"id,omitempty"` + PetId int64 `json:"petId,omitempty"` + Quantity int32 `json:"quantity,omitempty"` + ShipDate time.Time `json:"shipDate,omitempty"` + // Order Status Status string `json:"status,omitempty"` + Complete bool `json:"complete,omitempty"` } diff --git a/samples/client/petstore/go/swagger/Pet.go b/samples/client/petstore/go/swagger/Pet.go index d9faa1cb90f..32b9e6d97fc 100644 --- a/samples/client/petstore/go/swagger/Pet.go +++ b/samples/client/petstore/go/swagger/Pet.go @@ -3,11 +3,18 @@ package swagger 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"` + // pet status in the store Status string `json:"status,omitempty"` } diff --git a/samples/client/petstore/go/swagger/Tag.go b/samples/client/petstore/go/swagger/Tag.go index 77b55099c4a..7347106078a 100644 --- a/samples/client/petstore/go/swagger/Tag.go +++ b/samples/client/petstore/go/swagger/Tag.go @@ -3,7 +3,10 @@ package swagger import ( ) + type Tag struct { + Id int64 `json:"id,omitempty"` + Name string `json:"name,omitempty"` } diff --git a/samples/client/petstore/go/swagger/User.go b/samples/client/petstore/go/swagger/User.go index 03f0821252b..8f459db4674 100644 --- a/samples/client/petstore/go/swagger/User.go +++ b/samples/client/petstore/go/swagger/User.go @@ -3,13 +3,22 @@ package swagger 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"` + // User Status UserStatus int32 `json:"userStatus,omitempty"` }