google / google/gnostic

[Need Help] How can I generate Swagger/OpenAPI v3 spec from .proto files and vice versa

Open
#162 24 comments 3 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
279
PR merge metrics
No merged PRs in 30d

Description

It seems that only binary protocol buffers are supported for interconversion between protobuf and swagger. How can I convert binary protocol buffers (`.pb`) to and from proto3 protocol buffers (`.proto`), is that even a sane question to ask.

Moreover, my final intent is to be able to interconvert between `.proto` and OpenAPI2/3 spec (`.json/.yaml`) files, either using annotations in the `.proto` file, some tags or otherwise.

Thanks in advance!

### Edits:
Modifying the issue title a little to highlight the use case much better.

### External links:
[Stack Overflow | How to generate swagger3 (OpenAPI3) spec in (.json/.yaml) from protobuf (.proto) files?](https://stackoverflow.com/questions/61350097/how-to-generate-swagger3-openapi3-spec-in-json-yaml-from-protobuf-proto)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.