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.

    评论

报告相同问题?

悬赏问题

  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程