Generating OpenAPI documentation #256
-
I want to automatically generate openAPI documentation through proto like using grpc-gateway, how to do it in connect-go? |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 8 replies
-
Hm, that's a good question. Are you looking for documentation, like some HTML or text describing your API? Or are you looking for an OpenAPI specification that people can use to generate code and call your API? (I'm just getting used to Github discussions. This seemed like a better fit for a discussion rather than an issue, so I moved it - hope you don't mind!) |
Beta Was this translation helpful? Give feedback.
-
In an ideal world, you could probably generate for all languages, and have a proper implementations, and a proper distribution of the .proto files (or something like the BSR) could serve as the documentation. But openapi is pretty widespread and has support for many more things than just generating client/server. Some examples: Also, we are still not living in an ideal world, and this would help tremendously of moving us there. Serving |
Beta Was this translation helpful? Give feedback.
-
Well, you can generate gRPC for basically any language today, and connect-go will happily serve gRPC. The only major client left out is the browser, and we're working on that. OpenAPI sure has it's benefits, but I think the user experience of going from protobuf to openapi to a client or other tool isn't really smooth. That said, an OpenAPI generator for the Connect protocol should be pretty straight-forward once you have a JSON schema for the request and response types. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to generate a grcp-gateway proxy in front of grpc server that would essentially wire-compatible with the connect-go protocol? I mean, do the grcp-gateway proto extensions provide enough flexibility to do that? I'm thinking, since there is no native openapi generator for connect go, maybe I could decorate my proto files with google.api.http and protoc-gen-openapiv2/options/annotations.proto, and use protoc-gen-openapiv2 to generate swagger which accurately documents the connect-go protocol. |
Beta Was this translation helpful? Give feedback.
-
Hello! I would really appreciate it if there was a protobuf-plugin that would generate a static HTML page with documentation on how to use the API. It could include links to Connect's GitHub to show how to start implementing a client for the API in whichever language they want (connect-es, connect-go, connect-kotlin etc). A lot of these things are present in Swagger/OpenAPI, but it is not a requirement for us that Connect's generated documentation uses that technology. By not choosing Swagger/OpenAPI, the emphasis becomes on documentation and exploration, rather than generation of client. |
Beta Was this translation helpful? Give feedback.
-
OpenAPI and the ability to use We have a ton of existing clients and implementations, things we can not change because they are not even under our control. It's as simple as this question:
|
Beta Was this translation helpful? Give feedback.
-
Just wanted to say I would love to see buf adopt this. Right now generating good openapi specs to use for existing documentation tools (redoc, rapidoc, etc). We have been using gnostic https://github.com/google/gnostic/tree/main/cmd/protoc-gen-openapi but its not something that seems to be actively maintained and is pretty specific to how google does things (like having to specify http annotations instead of using the default for gRPC paths) It looks like there is some tooling starting to specifically target connect, but it would be great if buf directly supported some of this. |
Beta Was this translation helpful? Give feedback.
-
Problem statement: I want to be able to use connect so that I don't have to continue to vend type-specific proto bindings to my customers. I want customers to be able to cURL/interact with a set of raw HTTP APIs. Right now, there's no way for people to discover the correct API paths and shapes without prior knowledge of my gRPC service paths, request/response protojson format, and intricate understanding of the connect protocol itself. Please let me know if I'm wrong, but I think the above problem statement is the main reason why most folks will consider using connect. If there existed a well-supported way to generate static API docs for my service's connect-HTTP API spec, including streaming, then it would truly be a deal maker. |
Beta Was this translation helpful? Give feedback.
-
Generating an OpenAPI spec for the json side of ConnectRPC would be a game changer. |
Beta Was this translation helpful? Give feedback.
Hm, that's a good question. Are you looking for documentation, like some HTML or text describing your API? Or are you looking for an OpenAPI specification that people can use to generate code and call your API?
(I'm just getting used to Github discussions. This seemed like a better fit for a discussion rather than an issue, so I moved it - hope you don't mind!)