proto3-suite
proto3-suite copied to clipboard
compile-proto-file doesn't recognize "extend"
I've been trying to use the LightStep grpc protocol from Haskell, their IDL file depends on this one:
// Copyright (c) 2015, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/http.proto";
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}
This is what I get:
$ stack exec -- compile-proto-file --proto google/api/annotations.proto --out blah
Error: failed to compile "google/api/annotations.proto":
CompileParseError "/Users/ethercrow/src/lightstep/google/api/annotations.proto" (line 28, column 1):
unexpected "x"
expecting "enum"
I tried to grep the code and issues of this proto3-suite repository for extend
with no success, so maybe nobody just needed it before and it wasn't implemented?
@ethercrow That's correct; it was never implemented and the parser would need to be extended (and then some, see below).
It's been quite some time since I've looked at it, but IIRC: we can't parse google/protobuf/descriptor.proto
as it's for proto2, so we would need the ability to support a FileDescriptorSet
representation of it that was generated by a proto2 parser.
I believe a complete solution for supporting FileDescriptorSet
and extend
would entail replacing compile-proto-file
with a proper protoc
plugin, because then we could rely on the protoc
parser instead of our own.