Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile-proto-file doesn't recognize "extend" #115

Open
ethercrow opened this issue Sep 29, 2019 · 1 comment
Open

compile-proto-file doesn't recognize "extend" #115

ethercrow opened this issue Sep 29, 2019 · 1 comment

Comments

@ethercrow
Copy link

ethercrow commented Sep 29, 2019

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?

@intractable
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants