ysugimoto / grpc-graphql-gateway

A protoc plugin that generates graphql execution code from Protocol Buffers.
MIT License
382 stars 50 forks source link

also add input dependency #32

Closed ysugimoto closed 3 years ago

ysugimoto commented 3 years ago

Since #30, we have a bit problem that the nested message could not specify the argument list.

syntax = "proto3";

import "graphql.proto";
import "google/protobuf/wrappers.proto";

option go_package = ".;echo";

service Echo {
  // gRPC service information
  option (graphql.service) = {
    host: "localhost:50051"
    insecure: true
  };

  rpc Sample(SampleMessage) returns (SampleMessage) {
    option (graphql.schema) = {
      type: QUERY
      name: "sample"
    };
  }
}
message Member {
  int64 id = 2;
}

message SampleMessage {
  Member member = 1; // could not be assigned in request argument
}

To solve them, we can use FieldTypeInput always in argument definition but then we also need InputObject in package scope.

This change is just only one line but solves that problem,