Kong / insomnia

The open-source, cross-platform API client for GraphQL, REST, WebSockets, SSE and gRPC. With Cloud, Local and Git storage.
https://insomnia.rest
Apache License 2.0
34.4k stars 1.94k forks source link

gRPC: Not able to parse protoc-gen-validate defintions #4084

Open loeffel-io opened 2 years ago

loeffel-io commented 2 years ago

Is there an existing issue for this?

Insomnia Version

2021.5.3

What operating system are you using?

macOS

Operating System Version

11.6 (20G165)

Installation method

from website

Last Known Working Insomnia version

No response

Expected Behavior

Should parse this proto file without any problems:

syntax = "proto3";
package place;

option go_package = ".;protobuf";

import "validate/validate.proto";

message AutocompleteRequest {
  string value = 1 [(validate.rules).string.min_len = 3];
  string token = 2 [(validate.rules).string.uuid = true];
  string language = 3 [(validate.rules).string = {in: ["de", "en"]}];
}

message AutocompleteResponseItem {
  string id = 1;
  string description = 2;
}

message AutocompleteResponse {
  repeated AutocompleteResponseItem autocompleteResponseItems = 1;
}

message DetailRequest{
  string value = 1 [(validate.rules).string.min_len = 3];
  string token = 2 [(validate.rules).string.uuid = true];
  string language = 3 [(validate.rules).string = {in: ["de", "en"]}];
}

message DetailResponse{
  string Name = 1;
  string Street = 2;
  string StreetNumber = 3;
  uint64 Zip = 4;
  string City = 5;
  string Country = 6;
}

service PlaceService {
  rpc Autocomplete(AutocompleteRequest) returns (AutocompleteResponse) {}
  rpc Detail(DetailRequest) returns (DetailResponse) {}
}

Actual Behavior

Error: illegal value '[' (/Users/lucasloffel/go/src/github.com/ranked-de/ranked-place-grpc/protobuf/place.proto, line 11)
    at illegal (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:254947:16)
    at readValue (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:254986:19)
    at parseOptionValue (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:255432:33)
    at parseOption (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:255411:27)
    at parseInlineOptions (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:255464:17)
    at parseField_line (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:255231:13)
    at ifBlock (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:255145:17)
    at parseField (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:255221:9)
    at parseType_block (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:255193:21)
    at ifBlock (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:255141:17)

Reproduction Steps

No response

Additional Information

No response

zcong1993 commented 2 years ago

Any updates?

filfreire commented 2 years ago

Hi @loeffel-io, I am also able to reproduce this in Insomnia's latest stable version:

Image

We'll try to update you here as soon as there's any news or a potential fix. If anyone bumps into this issue and think they found a solution feel free to contribute a PR.

filfreire commented 1 year ago

@loeffel-io you should be able to use gRPC server reflection in latest Insomnia version which might help with these cases https://github.com/Kong/insomnia/releases/tag/core%402022.7.5

06kellyjac commented 1 year ago

protoc-gen-validate is being replaced with https://github.com/bufbuild/protovalidate

https://buf.build/blog/protoc-gen-validate-v1-and-v2/