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
0
votes
1 answer

Using composeResolvers with an array of resolvers

Is it possible to pass an array of resolvers into composeResolvers from "@graphql-tools/resolvers-composition". If I do something like composeResolvers(authorsResolvers, resolversComposition); it works however if I try to pass in all my resolvers,…
bp123
  • 3,217
  • 8
  • 35
  • 74
0
votes
1 answer

Graphql tools - mergeTypeDefs sort alphabetically

I'm using the following code to merge 2 typesDefs to one: import { mergeTypeDefs } from '@graphql-tools/merge'; import topicsTypes from '../modules/topics/typeDefs'; import contentTypes from '../modules/content/typeDefs'; const types =…
David Faizulaev
  • 4,651
  • 21
  • 74
  • 124
0
votes
0 answers

Accessing non-existent property of module exports inside circular dependency @graphql-tools makeExecutableSchema

I am working on a nodejs and graphql project. I was using nodejs 12 for a few years. But now when I updated to nodejs 16, I am getting these warnings, but the project works as before. Below warings are generated for every graphql types. (node:21588)…
0
votes
1 answer

How to convert AST to GraphQL

We need to rename the fields in the graphQL, so we get the AST of the GraphQL firstly, and modify it as we need. However, I can't find any solution to convert the AST back to the GraphQL. The parser I use is "GraphQL Dotnet Parser"
Charlie
  • 2,141
  • 3
  • 19
  • 35
0
votes
2 answers

Create Apollo-Server with Federated schema

I am trying to create an Apollo-Server with a Federated Schema of TypeDefs loaded from a GraphQL file. However, I am getting this error Argument of type 'GraphQLSchema' is not assignable to parameter of type 'string | TemplateStringsArray'. I…
Hazem Alabiad
  • 1,032
  • 1
  • 11
  • 24
0
votes
1 answer

How to get GraphQL subschema to delegateToSchema

Having trouble figuring out how/where to get subschema for delegateToSchema. I have 2 schemas in separate files which I am merging using mergeTypeDefs: # booking schema type Booking { id name } type Query { booking(id: Int!): Booking } and the…
aiiwa
  • 591
  • 7
  • 27
0
votes
1 answer

Graphql - How to get type (String, Int, ID etc..) of a selected field

I have the following graphql query const GET_USER = gql` query user() { user { firstName lastName } } ` I traverse through the query to find the type of the firstName & the lastName field using visit…
Eesa
  • 2,762
  • 2
  • 32
  • 51
0
votes
0 answers

How to react on GraphQL schema directives using graphql-tools

I have the following directive in y GraphQL schema to check if arguments are real slugs directive @slug on ARGUMENT_DEFINITION Query { subject(id: ID! @slug): Subject } We had a working solution before using SchemaDirectiveVisitor from…
Andreas Köberle
  • 106,652
  • 57
  • 273
  • 297
0
votes
1 answer

joining schemas from remote server by batching same types

I am new to apollo server and I am trying really hard to understand how to make remote schemas one huge scheme, I was able to join the schemas and can now query the data, however, I cannot seem to be able to link/resolve the type, my two micro…
Kim Rop
  • 142
  • 10
0
votes
1 answer

Define GraphQL object type in .graphql files not working

I'm trying to make a mutation in type-graphql and one of the arguments is Object so: @Mutation(() => Boolean) async createProduct( @Arg('name', () => String) name: string, @Arg('price', () => Int) price: number, @Arg('images', () =>…
0
votes
0 answers

can't run apollo-server-express with merged typeDefs and resolvers using @graphql-tools/merge

hey friends this is the structure of my project and files down below: starting from app.js file: import { Server } from "./src/Server"; import { config } from "dotenv"; config(); Server.StartServer(); Down below is the Server.ts file that is…
Emad Baqeri
  • 2,333
  • 2
  • 14
  • 29
0
votes
0 answers

GraphQL - resolve JSON as array of graphql types to support batch querying

I've got a collection of graphql services that are combined together in a gateway using graphql-tools schema stitching. Here's some sample code for reference: async function makeGatewaySchema() { // define the remote executors, introspect the…
0
votes
1 answer

How can I return enum options in GraphQL?

I have an enum in a schema like this: enum Classification { A B C D } And the following query: type Query { listClasification: Clasification } Ant the resolver on the JS code is the following: const classification = { A: 'A', B:…
Tlaloc-ES
  • 4,825
  • 7
  • 38
  • 84
0
votes
0 answers

Unable to merge schemas and resolvers correctly using graphql-tools

I tried to connect schemas and resolvers using graphql-tools. To do this, I moved them into separate folders, and used the mergeSchemas and mergeResolvers functions. I need to do this because there will be many models, the files will be large, and…
Kiten
  • 985
  • 2
  • 17
  • 35
0
votes
0 answers

Using graphql-tools's addMocksToSchema in a jest test doesn't work with gql from "@apollo/client"

I'm trying to use graphql-tools's addMocksToSchema function in a jest test with Apollo Client to allow me to test components that query Apollo by returning mock data that I can define for myself. However, the mock data isn't being properly returned…
Fredmental
  • 445
  • 1
  • 7
  • 14