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?
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.