Questions tagged [graphql-tools]

A set of utilities to build your JavaScript GraphQL schema in a concise and powerful way.

GraphQL Tools is an npm package and an opinionated structure for how to build a GraphQL schema and resolvers in JavaScript, following the GraphQL-first development workflow.

Documentation

Repository

115 questions
2
votes
0 answers

Custom directive to check list length for input types

I tried my best to write a custom directive in apollo server express to validate if an input type field of type [Int] does not have more than max length but do not know if its the right way to do. Appreciate if somebody could help me correct any…
Jithu
  • 447
  • 1
  • 9
  • 21
2
votes
1 answer

Graphql tool mergeSchemas throwing error if It gets more than 1 schema

I am trying to use graphql tool to perform schema stitching. However, if I pass more than one schema, it throws 2 error. sometimes it throws Object.keys(source).forEach(key => { ^ RangeError: Maximum call…
Kim Roy
  • 23
  • 2
2
votes
0 answers

Wrap remote GraphQL queries into common parent

I'm trying to do a standard GraphQL remote schema merge (which is working fine), but for each of the remote schemas, I'd like to wrap their queries in a top level query once merged for separation. For instance: # User Schema type User { id: ID! …
m_callens
  • 6,100
  • 8
  • 32
  • 54
2
votes
0 answers

Use the same GraphQL schema using different endpoints using Apollo

Context Today I have a simple GraphQL stitching server that unify two graphql applications into a single graphql endpoint AS IS It works introspecting each service (app 1 & app 2) and building an ApolloLink assigning a host url to each app with…
2
votes
0 answers

Graphql remote schema stiching and cookies

I have two graphql endpoints (authentiaction endpoint [AUTH] and application endpoint [APP]). I created the api gateway using "makeRemoteExecutableSchema" and "introspectSchema". The thing is that [AUTH] endpoint on login mutation sets a…
matiash
  • 53
  • 4
2
votes
0 answers

how to proceed with nested objects in a single object with graphql-tools

I have a GraphQL server using ExpressJS. Want to write a schema using GraphQL-Tools: I want to get a Object like this... User: { firstName, lastName, location: { city, state, lat, lan …
user10269224
  • 73
  • 10
1
vote
1 answer

How to merge results from two gql queries in to one array of results?

We have two services exposing two sets of schemas, merged in a gateway using Graphql Tools Schema Stitching Is it possible to merge queries from two services in such a way that it returns combined results? Example case: Book service contains data…
Jimish Fotariya
  • 1,004
  • 8
  • 21
1
vote
1 answer

How to read GrqphQL resolver

While I try to learn GraphQL-Tools.I found this article.In this article,example resolvers are described as follows. const resolvers = { Query: { posts: () => posts, author: (_, { id }) => find(authors, { id }) }, Mutation: { …
Heisenberg
  • 4,787
  • 9
  • 47
  • 76
1
vote
1 answer

(`typeDefs must contain only strings,... got ${typeof typeSource}`);

post.js const { gql } = require('apollo-server-express') const Posts = gql` type Query { totalPosts: Int! } `; module.exports = { Posts, } server.js const { ApolloServer } =…
1
vote
1 answer

GraphQL stitching VS merging schemas

What is the practical difference between merging and stitching GraphQL schemas? The graphql-tools documentation (merging:https://www.graphql-tools.com/docs/schema-merging,…
Peter Malik
  • 403
  • 4
  • 14
1
vote
1 answer

Customize the mock data defined against the types in graphql-tools

I am using graphql-tools to mock for my UI (create-react-app) functional tests. I have a question around the MockList Currently, I am mocking by type and one of the properties is an array but I still need to be able to customise the elements in the…
Joker
  • 55
  • 1
  • 8
1
vote
0 answers

Custom directive to check the value of two or more fields

I tried my best to write a custom directive in Apollo Server Express to validate two input type fields. But the code even works but the recording of the mutation already occurs. I appreciate if anyone can help me fix any error in the code…
1
vote
1 answer

Remove custom directives from schema before loading

I am using graphql-codegen with typescript-mongodb plugin to generate database model files from the qraphql schema. And therefore my schema contains custom directive from the typescript-mongodb like @entity and @column. The codegen works fine but…
Dmitry Klochkov
  • 2,484
  • 24
  • 31
1
vote
0 answers

GraphQL-tools: How do I write resolver function to search a list?

I'm just learning GraphQL, and am struggling on the return statement in a resolver function. All I want is to search for an item by ID. My search: query { link(id: "link-0") { url } } I keep getting this error: "message": "Cannot return…
ezeYaniv
  • 412
  • 5
  • 18
1
vote
1 answer

GraphQL Schema Delegation through Declarative Programming

I was looking at the documentation of graphql-tools, and wanted to know if we can use declarative programming model to delegate queries or mutations to sub-schemas? https://www.graphql-tools.com/docs/schema-delegation Specially the delegateToSchema…