Repository: deepmap/oapi-codegen
Pull request #123 (2020-01-20 16:51:20)

Introduce helper function for PATCH method


Patch:
diff --git a/examples/petstore-expanded/chi/api/petstore.gen.go b/examples/petstore-expanded/chi/api/petstore.gen.go
index f01ccfe..bbb58ff 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"`
 }
 
@@ -53,13 +63,13 @@ type AddPetJSONBody NewPet
 type AddPetJSONRequestBody AddPetJSONBody
 
 type ServerInterface interface {
-	//  (GET /pets)
+	// Returns all pets (GET /pets)
 	FindPets(w http.ResponseWriter, r *http.Request)
-	//  (POST /pets)
+	// Creates a new pet (POST /pets)
 	AddPet(w http.ResponseWriter, r *http.Request)
-	//  (DELETE /pets/{id})
+	// Deletes a pet by ID (DELETE /pets/{id})
 	DeletePet(w http.ResponseWriter, r *http.Request)
-	//  (GET /pets/{id})
+	// Returns a pet by ID (GET /pets/{id})
 	FindPetById(w http.ResponseWriter, r *http.Request)
 }
 
@@ -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+KwUmx06PYi9ymFO8lhcYIGsrUZLLWocSWT1T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Jz/ymVf57rHEheLvfJtbZM7vdaBFPcuUFbbyusYXjyre3",
+	"GnhAbcRpdM3iFkrVnK545LZFjzZ5tectbrWpDKO2E5apoeiIfewn7C6U/lYvuf62ddlLvrvMWoGMKNx/",
+	"kpC3BzGaCltY3Cq81185zhU76Li4/dYB9f124X6XXksSu/63yfU/W8YvFB3Vb0sob/Yynb3p71/a+5NX",
+	"X31/3d3v/hEAAP//81bN0nkSAAA=",
 }
 
 // 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..998cc55 100644
--- a/examples/petstore-expanded/echo/api/petstore-server.gen.go
+++ b/examples/petstore-expanded/echo/api/petstore-server.gen.go
@@ -17,12 +17,16 @@ import (
 
 // ServerInterface represents all server handlers.
 type ServerInterface interface {
+	// Returns all pets
 	// (GET /pets)
 	FindPets(ctx echo.Context, params FindPetsParams) error
+	// Creates a new pet
 	// (POST /pets)
 	AddPet(ctx echo.Context) error
+	// Deletes a pet by ID
 	// (DELETE /pets/{id})
 	DeletePet(ctx echo.Context, id int64) error
+	// Returns a pet by ID
 	// (GET /pets/{id})
 	FindPetById(ctx echo.Context, id int64) error
 }
@@ -131,33 +135,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++u8DEVyDYmbvd3U4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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..bf1187a 100644
--- a/examples/petstore-expanded/petstore-expanded.yaml
+++ b/examples/petstore-expanded/petstore-expanded.yaml
@@ -16,6 +16,7 @@ servers:
 paths:
   /pets:
     get:
+      summary: Returns all pets
       description: |
         Returns all pets from the system that the user has access to
         Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.
@@ -55,7 +56,8 @@ paths:
               schema:
                 $ref: '#/components/schemas/Error'
     post:
-      description: Creates a new pet in the store.  Duplicates are allowed
+      summary: Creates a new pet
+      description: Creates a new pet in the store. Duplicates are allowed
       operationId: addPet
       requestBody:
         description: Pet to add to the store
@@ -79,7 +81,8 @@ paths:
                 $ref: '#/components/schemas/Error'
   /pets/{id}:
     get:
-      description: Returns a user based on a single ID, if the user does not have access to the pet
+      summary: Returns a pet by ID
+      description: Returns a pet based on a single ID
       operationId: find pet by id
       parameters:
         - name: id
@@ -103,6 +106,7 @@ paths:
               schema:
                 $ref: '#/components/schemas/Error'
     delete:
+      summary: Deletes a pet by ID
       description: deletes a single pet based on the ID supplied
       operationId: deletePet
       parameters:
@@ -133,6 +137,7 @@ components:
             id:
               type: integer
               format: int64
+              description: Unique id of the pet
 
     NewPet:
       required:
@@ -140,8 +145,10 @@ components:
       properties:
         name:
           type: string
+          description: Name of the pet
         tag:
           type: string
+          description: Type of the pet
 
     Error:
       required:
@@ -151,5 +158,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)
 			}
diff --git a/pkg/codegen/templates/server-interface.tmpl b/pkg/codegen/templates/server-interface.tmpl
index 484e5b7..7380091 100644
--- a/pkg/codegen/templates/server-interface.tmpl
+++ b/pkg/codegen/templates/server-interface.tmpl
@@ -1,6 +1,6 @@
 // ServerInterface represents all server handlers.
 type ServerInterface interface {
-{{range .}}{{.SummaryAsComment -}}
+{{range .}}{{.SummaryAsComment }}
 // ({{.Method}} {{.Path}})
 {{.OperationId}}(ctx echo.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) error
 {{end}}
diff --git a/pkg/codegen/templates/templates.gen.go b/pkg/codegen/templates/templates.gen.go
index 37efc4d..1046593 100644
--- a/pkg/codegen/templates/templates.gen.go
+++ b/pkg/codegen/templates/templates.gen.go
@@ -719,7 +719,7 @@ type {{$opid}}{{.NameTag}}RequestBody {{.TypeDef}}
 `,
 	"server-interface.tmpl": `// ServerInterface represents all server handlers.
 type ServerInterface interface {
-{{range .}}{{.SummaryAsComment -}}
+{{range .}}{{.SummaryAsComment }}
 // ({{.Method}} {{.Path}})
 {{.OperationId}}(ctx echo.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params {{.OperationId}}Params{{end}}) error
 {{end}}
diff --git a/pkg/middleware/oapi_validate.go b/pkg/middleware/oapi_validate.go
index 8d994e7..2cf2af6 100644
--- a/pkg/middleware/oapi_validate.go
+++ b/pkg/middleware/oapi_validate.go
@@ -120,14 +120,25 @@ func ValidateRequestFromContext(ctx echo.Context, router *openapi3filter.Router,
 			// Split up the verbose error by lines and return the first one
 			// openapi errors seem to be multi-line with a decent message on the first
 			errorLines := strings.Split(e.Error(), "\n")
-			return echo.NewHTTPError(http.StatusBadRequest, errorLines[0])
+			return &echo.HTTPError{
+				Code:     http.StatusBadRequest,
+				Message:  errorLines[0],
+				Internal: err,
+			}
 		case *openapi3filter.SecurityRequirementsError:
-			return echo.NewHTTPError(http.StatusForbidden, e.Error())
+			return &echo.HTTPError{
+				Code:     http.StatusForbidden,
+				Message:  e.Error(),
+				Internal: err,
+			}
 		default:
 			// This should never happen today, but if our upstream code changes,
 			// we don't want to crash the server, so handle the unexpected error.
-			return echo.NewHTTPError(http.StatusInternalServerError,
-				fmt.Sprintf("error validating request: %s", err))
+			return &echo.HTTPError{
+				Code: http.StatusInternalServerError,
+				Message: fmt.Sprintf("error validating request: %s", err),
+				Internal: err,
+			}
 		}
 	}
 	return nil


Test patch:
diff --git a/internal/test/client/client.gen.go b/internal/test/client/client.gen.go
index 00a72ee..5965965 100644
--- a/internal/test/client/client.gen.go
+++ b/internal/test/client/client.gen.go
@@ -828,18 +828,25 @@ func ParseGetJsonWithTrailingSlashResponse(rsp *http.Response) (*getJsonWithTrai
 
 // ServerInterface represents all server handlers.
 type ServerInterface interface {
+
 	// (POST /with_both_bodies)
 	PostBoth(ctx echo.Context) error
+
 	// (GET /with_both_responses)
 	GetBoth(ctx echo.Context) error
+
 	// (POST /with_json_body)
 	PostJson(ctx echo.Context) error
+
 	// (GET /with_json_response)
 	GetJson(ctx echo.Context) error
+
 	// (POST /with_other_body)
 	PostOther(ctx echo.Context) error
+
 	// (GET /with_other_response)
 	GetOther(ctx echo.Context) error
+
 	// (GET /with_trailing_slash/)
 	GetJsonWithTrailingSlash(ctx echo.Context) error
 }
diff --git a/internal/test/components/components.gen.go b/internal/test/components/components.gen.go
index 618c6fb..a49fad1 100644
--- a/internal/test/components/components.gen.go
+++ b/internal/test/components/components.gen.go
@@ -1060,8 +1060,10 @@ func ParseBodyWithAddPropsResponse(rsp *http.Response) (*bodyWithAddPropsRespons
 
 // ServerInterface represents all server handlers.
 type ServerInterface interface {
+
 	// (GET /params_with_add_props)
 	ParamsWithAddProps(ctx echo.Context, params ParamsWithAddPropsParams) error
+
 	// (POST /params_with_add_props)
 	BodyWithAddProps(ctx echo.Context) error
 }
diff --git a/internal/test/issues/issue-52/issue.gen.go b/internal/test/issues/issue-52/issue.gen.go
index 6df59c3..f7a0d68 100644
--- a/internal/test/issues/issue-52/issue.gen.go
+++ b/internal/test/issues/issue-52/issue.gen.go
@@ -286,6 +286,7 @@ func ParseExampleGetResponse(rsp *http.Response) (*exampleGetResponse, error) {
 
 // ServerInterface represents all server handlers.
 type ServerInterface interface {
+
 	// (GET /example)
 	ExampleGet(ctx echo.Context) error
 }
diff --git a/internal/test/parameters/parameters.gen.go b/internal/test/parameters/parameters.gen.go
index f1845be..835b987 100644
--- a/internal/test/parameters/parameters.gen.go
+++ b/internal/test/parameters/parameters.gen.go
@@ -2190,40 +2190,58 @@ func ParseGetSimplePrimitiveResponse(rsp *http.Response) (*getSimplePrimitiveRes
 
 // ServerInterface represents all server handlers.
 type ServerInterface interface {
+
 	// (GET /contentObject/{param})
 	GetContentObject(ctx echo.Context, param ComplexObject) error
+
 	// (GET /cookie)
 	GetCookie(ctx echo.Context, params GetCookieParams) error
+
 	// (GET /header)
 	GetHeader(ctx echo.Context, params GetHeaderParams) error
+
 	// (GET /labelExplodeArray/{.param*})
 	GetLabelExplodeArray(ctx echo.Context, param []int32) error
+
 	// (GET /labelExplodeObject/{.param*})
 	GetLabelExplodeObject(ctx echo.Context, param Object) error
+
 	// (GET /labelNoExplodeArray/{.param})
 	GetLabelNoExplodeArray(ctx echo.Context, param []int32) error
+
 	// (GET /labelNoExplodeObject/{.param})
 	GetLabelNoExplodeObject(ctx echo.Context, param Object) error
+
 	// (GET /matrixExplodeArray/{.id*})
 	GetMatrixExplodeArray(ctx echo.Context, id []int32) error
+
 	// (GET /matrixExplodeObject/{.id*})
 	GetMatrixExplodeObject(ctx echo.Context, id Object) error
+
 	// (GET /matrixNoExplodeArray/{.id})
 	GetMatrixNoExplodeArray(ctx echo.Context, id []int32) error
+
 	// (GET /matrixNoExplodeObject/{.id})
 	GetMatrixNoExplodeObject(ctx echo.Context, id Object) error
+
 	// (GET /passThrough/{param})
 	GetPassThrough(ctx echo.Context, param string) error
+
 	// (GET /queryForm)
 	GetQueryForm(ctx echo.Context, params GetQueryFormParams) error
+
 	// (GET /simpleExplodeArray/{param*})
 	GetSimpleExplodeArray(ctx echo.Context, param []int32) error
+
 	// (GET /simpleExplodeObject/{param*})
 	GetSimpleExplodeObject(ctx echo.Context, param Object) error
+
 	// (GET /simpleNoExplodeArray/{param})
 	GetSimpleNoExplodeArray(ctx echo.Context, param []int32) error
+
 	// (GET /simpleNoExplodeObject/{param})
 	GetSimpleNoExplodeObject(ctx echo.Context, param Object) error
+
 	// (GET /simplePrimitive/{param})
 	GetSimplePrimitive(ctx echo.Context, param int32) error
 }
diff --git a/internal/test/schemas/schemas.gen.go b/internal/test/schemas/schemas.gen.go
index c17f9b8..b8fe16f 100644
--- a/internal/test/schemas/schemas.gen.go
+++ b/internal/test/schemas/schemas.gen.go
@@ -477,10 +477,13 @@ func ParseIssue9Response(rsp *http.Response) (*issue9Response, error) {
 
 // ServerInterface represents all server handlers.
 type ServerInterface interface {
+
 	// (GET /issues/30/{fallthrough})
 	Issue30(ctx echo.Context, pFallthrough string) error
+
 	// (GET /issues/41/{1param})
 	Issue41(ctx echo.Context, n1param N5StartsWithNumber) error
+
 	// (GET /issues/9)
 	Issue9(ctx echo.Context, params Issue9Params) error
 }
diff --git a/pkg/codegen/codegen_test.go b/pkg/codegen/codegen_test.go
index 0150471..f534d9e 100644
--- a/pkg/codegen/codegen_test.go
+++ b/pkg/codegen/codegen_test.go
@@ -44,6 +44,14 @@ 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")
+
+	// Check that the summary comment contains newlines
+	assert.Contains(t, code, `// Deletes a pet by ID
+	// (DELETE /pets/{id})
+`)
+
 	// Make sure the generated code is valid:
 	linter := new(lint.Linter)
 	problems, err := linter.Lint("test.gen.go", []byte(code))
diff --git a/pkg/testutil/request_helpers.go b/pkg/testutil/request_helpers.go
index 362b16f..16ea47f 100644
--- a/pkg/testutil/request_helpers.go
+++ b/pkg/testutil/request_helpers.go
@@ -71,6 +71,10 @@ func (r *RequestBuilder) Put(path string) *RequestBuilder {
 	return r.WithMethod("PUT", path)
 }
 
+func (r *RequestBuilder) Patch(path string) *RequestBuilder {
+	return r.WithMethod("PATCH", path)
+}
+
 func (r *RequestBuilder) Delete(path string) *RequestBuilder {
 	return r.WithMethod("DELETE", path)
 }