Repository: deepmap/oapi-codegen
Pull request #121 (2020-01-20 08:30:09)

Generate Comments for Struct Fields
The first commit introduces a test (which fails) and the second commit the implementation (to fix the test).

srueg: Failing build: https://travis-ci.com/deepmap/oapi-codegen/builds/145175906

Patch:
diff --git a/examples/petstore-expanded/chi/api/petstore.gen.go b/examples/petstore-expanded/chi/api/petstore.gen.go
index f01ccfe..a741ca3 100644
--- a/examples/petstore-expanded/chi/api/petstore.gen.go
+++ b/examples/petstore-expanded/chi/api/petstore.gen.go
@@ -18,14 +18,22 @@ import (
 
 // Error defines model for Error.
 type Error struct {
-	Code    int32  `json:"code"`
+
+	// Error code
+	Code int32 `json:"code"`
+
+	// Error message
 	Message string `json:"message"`
 }
 
 // NewPet defines model for NewPet.
 type NewPet struct {
-	Name string  `json:"name"`
-	Tag  *string `json:"tag,omitempty"`
+
+	// Name of the pet
+	Name string `json:"name"`
+
+	// Type of the pet
+	Tag *string `json:"tag,omitempty"`
 }
 
 // Pet defines model for Pet.
@@ -33,6 +41,8 @@ type Pet struct {
 	// Embedded struct due to allOf(#/components/schemas/NewPet)
 	NewPet
 	// Embedded fields due to inline allOf schema
+
+	// Unique id of the pet
 	Id int64 `json:"id"`
 }
 
@@ -189,33 +199,34 @@ func HandlerFromMux(si ServerInterface, r *chi.Mux) http.Handler {
 // Base64 encoded, gzipped, json marshaled Swagger object
 var swaggerSpec = []string{
 
-	"H4sIAAAAAAAC/+RXS28cuRH+KwUmx06PYi9ymFO8lhcYIGsrUZLLWocSWT1TCz5aZHFkQZj/HhS752XN",
-	"ylgkCBbYyzy6+fjqq6+KH5+NTWFMkaIUs3w2xW4oYPv5IeeU9ceY00hZmNpjmxzp95ByQDFLw1HevjGd",
-	"kaeRpr+0pmx2nQlUCq7b6PllkcxxbXa7zmR6qJzJmeVP05rH8Xe7znykxxuSl9tHDJcW7Izg+tsbtdm6",
-	"/Lw2ev9pMMufns0fMw1maf6wOPKxmMlYzFh23ddg2H3NxF++u8DEVyDYmbvd3U4fcxzS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 
 // GetSwagger returns the Swagger specification corresponding to the generated code
diff --git a/examples/petstore-expanded/echo/api/petstore-server.gen.go b/examples/petstore-expanded/echo/api/petstore-server.gen.go
index 015b6b0..559b5de 100644
--- a/examples/petstore-expanded/echo/api/petstore-server.gen.go
+++ b/examples/petstore-expanded/echo/api/petstore-server.gen.go
@@ -131,33 +131,34 @@ func RegisterHandlers(router interface {
 // Base64 encoded, gzipped, json marshaled Swagger object
 var swaggerSpec = []string{
 
-	"H4sIAAAAAAAC/+RXS28cuRH+KwUmx06PYi9ymFO8lhcYIGsrUZLLWocSWT1TCz5aZHFkQZj/HhS752XN",
-	"ylgkCBbYyzy6+fjqq6+KH5+NTWFMkaIUs3w2xW4oYPv5IeeU9ceY00hZmNpjmxzp95ByQDFLw1HevjGd",
-	"kaeRpr+0pmx2nQlUCq7b6PllkcxxbXa7zmR6qJzJmeVP05rH8Xe7znykxxuSl9tHDJcW7Izg+tsbtdm6",
-	"/Lw2ev9pMMufns0fMw1maf6wOPKxmMlYzFh23ddg2H3NxF++u8DEVyDYmbvd3U4fcxzSRGoUtA0SBWRv",
-	"lgZHFsLw1/KI6zXlnpPp5ujN7fQM3t2s4J+EwXSmZp20ERmXi8XJnF1nHBWbeRRO0SzNOygYRk9tsmxQ",
-	"oBYqgDCSFEmZAAtgBPoyDZMEjkKKRTIKwUAoNVMBjiAbgk8jRV3pbX8FZSTLA1tsW3XGs6VY6Jg2825E",
-	"uyF401+dQS7LxeLx8bHH9rpPeb2Y55bF31bvP3y8/fCnN/1Vv5HgW64ph/JpuKW8ZUuX4l60IQtNBos/",
-	"5exmDtN0Zku5TKT8ub/qr3TlNFLEkc3SvG2POjOibFqyF0qQ/lhP2jmn9R8kNccC6H1jEoacQmOoPBWh",
-	"MFGt/2uhDBsl2VoqBSR9jh8xQCEHNkXHgaLUAFSkhx+RLEUsIBTGlKHgmkW4QMGRKXYQyULepGhrgULh",
-	"ZAALYCDp4R1FwggosM64ZYeAdV2pA7TAaKvnNrWH9zXj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hIbjSvg9L9kIZHp6NWgEzN4+V8vPhnNdx5tg8LNEX6iYP",
+	"2WyKUGiH0rmpGh9gzvis/4s8t3NQ3UrzO6eQAn7loH29hgfKanAyleql4cztcPsGSM+B5W2Uv2lXt/c6",
+	"vwzafFo4766udr6I4ujnhsFP1mL2a1HML5d4eMvsjU7vFTPbM4c0kMAOzOiflli9/C48b8EYbf+FjWuk",
+	"r4M2X+3S+zFDKhf8xodMKM23RXpSx7EzZM3c9AA3dcSnY9TUeZ+eyJ1J9tqpYqf0UZHvk3v+j0W6c9fn",
+	"od6SqLDQOf3a4z6RkeRK239TF78phz94+rfd6DtnL+y2owo8yYVr1vhc9VA4rny7m8ADajtNozAWN1Cq",
+	"or6ggps2exTCm51rcaOtYRizN2GZ2oIa5UNXYHeWy291hMt3pvOO8N151ApkROH+AJX69sVgNP77lOwT",
+	"tbjpgJeHq4FLVCAmgTVu6HBJOLpwXjx0vn9euN+VvSWJXf/Xkvc/VrZ64FLe7NJwcjvfXbT7o+uq3jm3",
+	"99t/BQAA//8F3U+JLRIAAA==",
 }
 
 // GetSwagger returns the Swagger specification corresponding to the generated code
diff --git a/examples/petstore-expanded/echo/api/petstore-types.gen.go b/examples/petstore-expanded/echo/api/petstore-types.gen.go
index 79c6a2f..652b41e 100644
--- a/examples/petstore-expanded/echo/api/petstore-types.gen.go
+++ b/examples/petstore-expanded/echo/api/petstore-types.gen.go
@@ -5,14 +5,22 @@ package api
 
 // Error defines model for Error.
 type Error struct {
-	Code    int32  `json:"code"`
+
+	// Error code
+	Code int32 `json:"code"`
+
+	// Error message
 	Message string `json:"message"`
 }
 
 // NewPet defines model for NewPet.
 type NewPet struct {
-	Name string  `json:"name"`
-	Tag  *string `json:"tag,omitempty"`
+
+	// Name of the pet
+	Name string `json:"name"`
+
+	// Type of the pet
+	Tag *string `json:"tag,omitempty"`
 }
 
 // Pet defines model for Pet.
@@ -20,6 +28,8 @@ type Pet struct {
 	// Embedded struct due to allOf(#/components/schemas/NewPet)
 	NewPet
 	// Embedded fields due to inline allOf schema
+
+	// Unique id of the pet
 	Id int64 `json:"id"`
 }
 
diff --git a/examples/petstore-expanded/petstore-client.gen.go b/examples/petstore-expanded/petstore-client.gen.go
index 507501d..ea6050c 100644
--- a/examples/petstore-expanded/petstore-client.gen.go
+++ b/examples/petstore-expanded/petstore-client.gen.go
@@ -18,14 +18,22 @@ import (
 
 // Error defines model for Error.
 type Error struct {
-	Code    int32  `json:"code"`
+
+	// Error code
+	Code int32 `json:"code"`
+
+	// Error message
 	Message string `json:"message"`
 }
 
 // NewPet defines model for NewPet.
 type NewPet struct {
-	Name string  `json:"name"`
-	Tag  *string `json:"tag,omitempty"`
+
+	// Name of the pet
+	Name string `json:"name"`
+
+	// Type of the pet
+	Tag *string `json:"tag,omitempty"`
 }
 
 // Pet defines model for Pet.
@@ -33,6 +41,8 @@ type Pet struct {
 	// Embedded struct due to allOf(#/components/schemas/NewPet)
 	NewPet
 	// Embedded fields due to inline allOf schema
+
+	// Unique id of the pet
 	Id int64 `json:"id"`
 }
 
diff --git a/examples/petstore-expanded/petstore-expanded.yaml b/examples/petstore-expanded/petstore-expanded.yaml
index 8628048..12a2442 100644
--- a/examples/petstore-expanded/petstore-expanded.yaml
+++ b/examples/petstore-expanded/petstore-expanded.yaml
@@ -133,6 +133,7 @@ components:
             id:
               type: integer
               format: int64
+              description: Unique id of the pet
 
     NewPet:
       required:
@@ -140,8 +141,10 @@ components:
       properties:
         name:
           type: string
+          description: Name of the pet
         tag:
           type: string
+          description: Type of the pet
 
     Error:
       required:
@@ -151,5 +154,7 @@ components:
         code:
           type: integer
           format: int32
+          description: Error code
         message:
           type: string
+          description: Error message
diff --git a/pkg/codegen/schema.go b/pkg/codegen/schema.go
index 6db35e8..b591ca0 100644
--- a/pkg/codegen/schema.go
+++ b/pkg/codegen/schema.go
@@ -187,6 +187,7 @@ func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) {
 					JsonFieldName: pName,
 					Schema:        pSchema,
 					Required:      required,
+					Description:   p.Value.Description,
 				}
 				outSchema.Properties = append(outSchema.Properties, prop)
 			}


Test patch:
diff --git a/pkg/codegen/codegen_test.go b/pkg/codegen/codegen_test.go
index 0150471..cbe45e3 100644
--- a/pkg/codegen/codegen_test.go
+++ b/pkg/codegen/codegen_test.go
@@ -44,6 +44,9 @@ func TestExamplePetStoreCodeGeneration(t *testing.T) {
 	// Check that the client method signatures return response structs:
 	assert.Contains(t, code, "func (c *Client) FindPetById(ctx context.Context, id int64) (*http.Response, error) {")
 
+	// Check that the property comments were generated
+	assert.Contains(t, code, "// Unique id of the pet")
+
 	// Make sure the generated code is valid:
 	linter := new(lint.Linter)
 	problems, err := linter.Lint("test.gen.go", []byte(code))