A new field of resolve which resolves as a nested query.
Example usage
syntax = "proto3";
import "graphql.proto";
option go_package = ".;echo";
service Echo {
option (graphql.service) = {
host: "localhost:50051"
insecure: true
};
rpc Echo (EchoRequest) returns (EchoResponse) {
option (graphql.schema) = {
type: QUERY
name: "echo"
};
}
rpc GetMember(GetMessageRequest) returns (Member) {
option (graphql.schema) = {
type: RESOLVER // when define as "RESOLVER", it is used for nested query resolving, not in public query
name: "getMember"
};
}
}
message EchoRequest {
}
message EchoResponse {
int64 id = 1;
// Define field with "resolve" field option. The value should be query name which is defined as "RESOLVER".
Member member = 2 [(graphql.field).resolve = "getMember"];
}
message GetMessageRequest {
// This field value is passed via EchoResponse.id
int64 id = 1;
}
message Member {
string name = 1;
int64 id = 2;
}
And then GraphQL query should be:
curl http://localhost:8000 -d '
{
echo {
member {
id
name
}
}
}'
This PR implement nested query resolving.
New graphql.proto option
A new field of
resolve
which resolves as a nested query.Example usage
And then GraphQL query should be:
For example, the response should be: