nilslice / protolock

Protocol Buffer companion tool. Track your .proto files and prevent changes to messages and services which impact API compatibility.
https://protolock.dev
BSD 3-Clause "New" or "Revised" License
605 stars 37 forks source link

found "stream" but expected [rpc method] for a valid proto #137

Closed shreyanshp closed 2 years ago

shreyanshp commented 2 years ago
service MyStreamService {
    rpc stream (MyStreamRequest) returns (stream MyStreamResponse);
}

returns

mystreamservice.proto:10:9: found "stream" but expected [rpc method]
shreyanshp commented 2 years ago

also replicated here https://protolock.dev/

proto

// Copyright 2015 The gRPC Authors
// http://www.apache.org/licenses/LICENSE-2.0
//
// The canonical version of this proto can be found at
// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto

syntax = "proto3";

package grpc.health.v1;

message HealthCheckRequest {
  string service = 1;
}

message HealthCheckResponse {
  enum ServingStatus {
    UNKNOWN = 0;
    SERVING = 1;
    NOT_SERVING = 2;
    SERVICE_UNKNOWN = 3; 
  }
  ServingStatus status = 1;
}

service Health {
  rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
  rpc stream (HealthCheckRequest) returns (stream HealthCheckResponse);
}

image

nilslice commented 2 years ago

Hi @shreyanshp - are you expecting something different? Your example is invalid Protobuf as fas as I know. It should be:

service MyStreamService {
    rpc (stream MyStreamRequest) returns (stream MyStreamResponse);
}

Maybe I am misunderstanding the issue though, please let me know.

nilslice commented 2 years ago

Going to close this, as I think it is an error in your proto file - but please re-open if that is not the case. Thanks!