Kreya icon indicating copy to clipboard operation
Kreya copied to clipboard

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

Open DmitriiDuninDD opened this issue 1 year ago • 5 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

https://github.com/riok/Kreya/assets/117779391/a86151e2-0a7e-4f83-a6fe-7c1a5bc30b8d

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

DmitriiDuninDD avatar Sep 21 '23 03:09 DmitriiDuninDD

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?

CommonGuy avatar Sep 21 '23 11:09 CommonGuy

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.

DmitriiDuninDD avatar Sep 21 '23 18:09 DmitriiDuninDD

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

DmitriiDuninDD avatar Sep 28 '23 17:09 DmitriiDuninDD

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

CommonGuy avatar Oct 02 '23 13:10 CommonGuy

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

CommonGuy avatar May 17 '24 13:05 CommonGuy

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

CommonGuy avatar Jun 12 '24 09:06 CommonGuy