dqwh1119 2018-10-19 00:19
浏览 3419

在golang中导入“ google / protobuf / descriptor.proto”

I'm using custom options to define swagger annotations for my proto service definition.

There is already an implementation of this swagger annotations so I just need to import this implementation on my .proto service definition

import "protoc-gen-swagger/options/annotations.proto";
...

The problem is that this library has a dependency of google/protobuf/descriptor.proto and this descriptor library was created on proto2 specification(this library is from the protocolbuffers/protobuf project)

syntax = "proto2";
package google.protobuf; 

so when I tried to build the proto for php I receive the error:

-php_out: google/protobuf/descriptor.proto: Can only generate PHP code 
for proto3 .proto files. Please add 'syntax = "proto3";' to the top of 
your .proto file.

Does anyone know where I can find the proto definition of google/protobuf/descriptor.proto on proto buffers version 3? o how can I resolve this issue?

  • 写回答

1条回答 默认 最新

  • dongzhong8691 2018-10-19 01:37
    关注

    The generator library protoc-gen-swagger only supports protobuf version 3. Your error will keep keep coming up unless you changed proto2 to proto3. Please read https://grpc-ecosystem.github.io/grpc-gateway/docs/usage.html.

    Also it's clearly stated on your error message:

    -php_out: google/protobuf/descriptor.proto: Can only generate PHP code for proto3 .proto files. Please add 'syntax = "proto3";' to the top of your .proto file.

    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效