Skip to content

Commit

Permalink
feat: schemaComposer.Query for RPC methods starting with list (#1141)
Browse files Browse the repository at this point in the history
* feat: use Query schema for methods starting with list

* doc: added changeset

Co-authored-by: Sohrab Shahinfar <s.shahinfar@alibaba.ir>
  • Loading branch information
sohmil97 and Sohrab Shahinfar authored Nov 12, 2020
1 parent 2fce70c commit 50cffde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/brave-jars-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-mesh/grpc': minor
---

Added schemaComposer.Query for RPC methods starting with list
2 changes: 1 addition & 1 deletion packages/handlers/grpc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default class GrpcHandler implements MeshHandler {
} else {
const clientMethod = promisify<ClientUnaryCall>(client[methodName].bind(client) as ClientMethod);
const identifier = methodName.toLowerCase();
const rootTC = identifier.startsWith('get') ? schemaComposer.Query : schemaComposer.Mutation;
const rootTC = (identifier.startsWith('get') || identifier.startsWith('list')) ? schemaComposer.Query : schemaComposer.Mutation;
rootTC.addFields({
[rootFieldName]: {
...fieldConfig,
Expand Down

0 comments on commit 50cffde

Please sign in to comment.