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

Can't use imported messages directly in request messages #205

Closed
pauln opened this issue Jul 24, 2017 · 2 comments
Closed

Can't use imported messages directly in request messages #205

pauln opened this issue Jul 24, 2017 · 2 comments

Comments

@pauln
Copy link
Contributor

pauln commented Jul 24, 2017

Attempting to use imported messages directly in a request message results in the following error:

�[33mWARN�[0m[0000] Code formatting error, generated service will not build, outputting unformatted code  �[33merror�[0m=83:3: expected 'IDENT', found '%' (and 10 more errors)

If you wrap the imported message, the error goes away. There is no such error when using imported messages directly in response messages.

Non-working example:

// input.proto
syntax = "proto3";
package input;

message Data {
    string Content = 1;
}
// echo.proto
syntax = "proto3";
package echo;

import "github.com/TuneLab/truss/deftree/googlethirdparty/annotations.proto";
import "input.proto";

service Echo {
  rpc Echo (EchoRequest) returns (EchoResponse) {
    option (google.api.http) = {
        post: "/echo"
        body: "*"
      };
  }
}

message EchoRequest {
  string ID = 1;
  input.Data In = 2;
}

message EchoResponse {
  string Out = 1;
}

If you change echo.proto to the following, the error goes away:

// echo.proto
syntax = "proto3";
package echo;

import "github.com/TuneLab/truss/deftree/googlethirdparty/annotations.proto";
import "input.proto";

service Echo {
  rpc Echo (EchoRequest) returns (EchoResponse) {
    option (google.api.http) = {
        post: "/echo"
        body: "*"
      };
  }
}

message EchoRequest {
  string ID = 1;
  WrappedData In = 2;
}

message EchoResponse {
  string Out = 1;
}

message WrappedData {
  input.Data Datum = 1;
}
@pauln pauln changed the title Can't use imported messages directly Can't use imported messages directly in request messages Jul 24, 2017
@adamryman
Copy link
Member

This is a duplication of #201

See my comment there about some of the reasons why we currently have this issue: #201 (comment)

@pauln
Copy link
Contributor Author

pauln commented Jul 24, 2017

Sorry - I didn't see #201 / connect it with this issue. That does indeed seem to be what I'm hitting here, though it's interesting that the code formatting warnings only arise if using the imported message directly in a request message - using them directly in a response message doesn't generate any.

@pauln pauln closed this as completed Jul 24, 2017
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