javascript - 有没有办法从 protobuf 生成 GraphQL 模式?

标签 javascript node.js protocol-buffers graphql graphql-js

我有一个相当大/复杂的 API protobuf 定义,我想知道是否有一个方便的工具可以从这个 protobuf 的子集自动生成文本 GraphQL 模式及其(嵌套)类型?

我在正常使用 Node.js,但我愿意接受其他语言来生成架构。

最佳答案

如果你愿意使用 GoLang,这里有一个 protobuf 到 GraphQL 转换器

https://github.com/opsee/protobuf

Current gadgets graphql

The graphql gadget will generate a graphql schema for protobuf messages for use with the go-graphql package. It defines extensions for use in files, messages, and fields. See examples for usage -- the files generated by the plugin are flavortown.pb.go and flavortownpb_test.go.

关于javascript - 有没有办法从 protobuf 生成 GraphQL 模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44397956/

相关文章:

gradle - Gradle Protobuf自定义任务

compiler-errors - libprotoc 编译 protoc 文件,但不编译其中包含的其他 protoc(google grpc assistant annotations.pb.h no file or directory error)

javascript - 使用 JQuery 为标签赋值?

javascript - 将前导零添加到 moment.js 时间

javascript - 在chrome扩展中获取 "Remote Address"(IP地址)

node.js - 使用 'require' 时如何从库中加载 CSS

node.js - 监控和分析导致应用程序崩溃

javascript - 从多个数组填充 HTML 表

用于 socket.io 服务器的 Node.js 客户端

c++ - 如何使用 ZMQ 发送/接收使用 Protocol Buffers 序列化的二进制数据