riok/Kreya

Brackets containing a value in service option will cause the whole file to not be imported.

Closed this issue · 6 comments

Describe the bug
Importing a structure having brackets in value will silently fail and will not be imported

To Reproduce

import "google/protobuf/descriptor.proto";

service SomeService {
  option (service_rule) = {
    name_spaces: ["namespace"]
  };

  rpc GetSomething(GetSomethingRequest) returns (GetSomethingResponse);
}

message GetSomethingRequest {
  google.protobuf.BoolValue is_true = 1;
}

message GetSomethingResponse {
  google.protobuf.BoolValue is_true = 1;
}

message ServiceRule {
  repeated string name_spaces = 6;
}

extend google.protobuf.ServiceOptions {
  required ServiceRule service_rule = 1;
}

Expected behavior
Service SomeService to be imported with GetSomething operation available

Screenshots
Video recording of the process

Screen.Recording.2023-09-20.at.8.22.46.PM.mov

Environment (if possible, copy the information from the error dialog or the About menu):

{
  "kreyaVersion": "1.11.1",
  "releaseChannel": "stable",
  "osDescription": "Darwin 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000",
  "osVersion": "Unix 13.5.2",
  "osArch": "Arm64",
  "processArch": "Arm64",
  "runtimeIdentifier": "osx.13-arm64",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)"
}

Additional context
BloomRPC is deprecated, but throws an error trying to parse the value in brackets, Kreya silently omits the import making the process of source investigation longer, Postman imports files, but cannot process multi-line comments (/* */ blocks).

As far as I know, the brackets are invalid according to Protobuf, correct? You wouldn't be able to generate a gRPC client/server from this protobuf file.

So the bug in Kreya is not showing an error that an invalid protobuf file has been imported?

I believe brackets are valid at least for annotating the field or here's the example from Google's GH

If to go for a concrete example of options being described in a way above, I think this could do

That said, I think a parsing error for what is considered invalid syntax would definitely be nice.

@CommonGuy
Hey Manuel, would my examples above be good to consider this request as a bug/feature request?

@DmitriiDuninDD Yes, the example is enough :) I was mostly curious about the expected behaviour. Added this to our backlog

This has been fixed in the latest beta version and will be released in the next stable version

Kreya 1.15 has just been released. It now either parses protobuf files successfully or fails on errors.