简体   繁体   English

将 .proto 转换为 Json 或 yaml

[英]Converting .proto to Json or yaml

New to protobuf. protobuf 的新手。 I have a bunch of .proto files which defines numerous endpoints.我有一堆 .proto 文件,它们定义了许多端点。 I would like to programmatically extract the endpoint definitions along with other method data defined in the endpoint specs.我想以编程方式提取端点定义以及端点规范中定义的其他方法数据。 Is there an easy way to do this ?是否有捷径可寻 ?

Interesting question.有趣的问题。

I'm unaware of any tools like jq for JSON and yq for YAML for processing|querying protos but it would be a useful tool to have.我不知道有任何工具,例如用于 JSON 的jq和用于 YAML 的用于处理|查询原型的yq ,但它会是一个有用的工具。

I think there are probably tools out there that can help with the documentation aspect of protos but I've not used any.我认为可能有一些工具可以帮助处理 protos 的文档方面,但我没有使用任何工具。 The folks at Buf are doing some interesting work. Buf的人们正在做一些有趣的工作。 Theirschema registry may be of interest?他们的模式注册表可能很有趣? I've not used it.我没用过。

Otherwise, you could one of the SDKs that supports reflection (eg Go's v2 SDK supports this ) and build a solution.否则,您可以使用支持反射的 SDK 之一(例如 Go 的 v2 SDK 支持功能)并构建解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM