-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gen-swagger does not generate PATCH method endpoints #211
Comments
AFAICT the patch is fairly simple: diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go
index d33aba5..9db445c 100644
--- a/protoc-gen-swagger/genswagger/template.go
+++ b/protoc-gen-swagger/genswagger/template.go
@@ -437,6 +437,9 @@ func renderServices(services []*descriptor.Service, paths swaggerPathsObject, re
case "PUT":
pathItemObject.Put = operationObject
break
+ case "PATCH":
+ pathItemObject.Patch = operationObject
+ break
}
paths[templateToSwaggerPath(b.PathTmpl.Template)] = pathItemObject
}
diff --git a/protoc-gen-swagger/genswagger/types.go b/protoc-gen-swagger/genswagger/types.go
index b91e457..a31f3ec 100644
--- a/protoc-gen-swagger/genswagger/types.go
+++ b/protoc-gen-swagger/genswagger/types.go
@@ -66,6 +66,7 @@ type swaggerPathItemObject struct {
Delete *swaggerOperationObject `json:"delete,omitempty"`
Post *swaggerOperationObject `json:"post,omitempty"`
Put *swaggerOperationObject `json:"put,omitempty"`
+ Patch *swaggerOperationObject `json:"patch,omitempty"`
}
// http://swagger.io/specification/#operationObject |
That looks like a really great start! Do you think you could turn that into a pull request and send it in? Thanks so much |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The grpc-gateway generator correctly generates working endpoints using the patch method, but the swagger generator just outputs empty data for those paths.
For example:
generates a path that looks like this:
instead of generating the correct swagger output, which would be something like this:
The text was updated successfully, but these errors were encountered: