The JavaScript reference implementation for GraphQL, a query language created by Facebook for describing data requirements on complex application data models.
Questions tagged [graphql-js]
1489 questions
96
votes
10 answers
GraphQL Expected Iterable, but did not find one for field xxx.yyy
I'm currently trying GraphQL with NodeJS and I don't know, why this error occurs with the following query:
{
library{
name,
user {
name
email
}
}
}
I am not sure if the type of my resolveLibrary is right, because at any…

Vetterjack
- 2,227
- 4
- 19
- 31
92
votes
1 answer
what's the difference between parseValue and parseLiteral in GraphQLScalarType
Looking through the GraphQL documentation for custom scalar types (I'm trying to create my own date type) I'm not sure what the difference between parseValue and parseLiteral are.
http://graphql.org/graphql-js/type/#graphqlscalartype
The…

MonkeyBonkey
- 46,433
- 78
- 254
- 460
82
votes
5 answers
Firebase & GraphQL
Does anyone have any experience with GraphQL and Firebase?
I figure one would place the firebase calls in the resolver of the relevant field, passing some variable from the props of the component into the arguments of the query.
How can we insert…

omgj
- 1,369
- 3
- 12
- 18
78
votes
1 answer
Field \"me\" of type \"User\" must have a selection of subfields
Hi I am trying to learn GraphQL language. I have below snippet of code.
// Welcome to Launchpad!
// Log in to edit and save pads, run queries in GraphiQL on the right.
// Click "Download" above to get a zip with a standalone Node.js server.
// See…

N Sharma
- 33,489
- 95
- 256
- 444
78
votes
8 answers
Document a GraphQL API
With REST we can use Swagger, RAML or other technologies to document our API and generate an HTML documentation that our consumers can read without any need of interaction with the servers.
Does something similar exist for GraphQL? Is there any way…

Francisco Canela
- 1,084
- 1
- 7
- 14
75
votes
2 answers
How to add default values to input arguments in graphql
I have this input type and I would like to add a default Value to one of the fields. I want to add 0 to the value field inside the ExampleInput.
type ExampleType {
value: Int
another: String
}
type Mutation {
example(input: ExampleInput):…

Adolfo
- 1,315
- 2
- 14
- 22
67
votes
1 answer
GraphQL: Non-nullable array/list
I'm learning GraphQL now and while walking through tutorial I met behavior that I can't understand.
Let's say we have defined type in schema:
type Link {
id: ID!
url: String!
description: String!
postedBy: User
votes: [Vote!]!
}
Due to…

DefLee
- 685
- 1
- 5
- 6
64
votes
5 answers
How do you prevent nested attack on GraphQL/Apollo server?
How do you prevent a nested attack against an Apollo server with a query such as:
{
authors {
firstName
posts {
title
author {
firstName
posts{
title
author {
firstName
…

jboothe
- 1,043
- 1
- 11
- 15
63
votes
3 answers
How to query list of objects with array as an argument in GraphQL
I'm trying to query a list of objects having array of IDs. Something similar to following SQL query:
SELECT name FROM events WHERE id IN(1,2,3,...);
How do I achieve this in GraphQL?

Rafael Sedrakyan
- 2,541
- 10
- 34
- 42
62
votes
4 answers
Can you make a graphql type both an input and output type?
I have some object types that I'd like to use as both input and output - for instance a currency type or a reservation type.
How do I define my schema to have a type that supports both input and output - I don't want to duplicate code if I don't…

MonkeyBonkey
- 46,433
- 78
- 254
- 460
56
votes
8 answers
Graphql post body "Must provide query string."
I use Express-graphql middleware.
I send the following request in the body line:
POST /graphql HTTP/1.1
Host: local:8083
Content-Type: application/graphql
Cache-Control: no-cache
Postman-Token: d71a7ea9-5502-d5fe-2e36-0ae49c635a29
{
testing {
…

Gopard
- 922
- 1
- 12
- 26
56
votes
1 answer
In Relay, what role do the node interface and the global ID spec play?
I started out with the relay-starter-kit and also worked my way through the Relay and GraphQL documentation. But there are quite a few areas that are unexplained and mysterious.
Seriously I read a lot of documentations everywhere about all these…

Christine
- 3,014
- 2
- 24
- 34
53
votes
6 answers
GraphQL Blackbox / "Any" type?
Is it possible to specify that a field in GraphQL should be a blackbox, similar to how Flow has an "any" type? I have a field in my schema that should be able to accept any arbitrary value, which could be a String, Boolean, Object, Array, etc.

Jon Cursi
- 3,301
- 4
- 27
- 53
50
votes
1 answer
Notable differences between buildSchema and GraphQLSchema?
Are there any notable differences between the two? Im interested in anything from runtime and startup performance to features and workflow differences. Documentation does a poor job on explaining the difference and when I should use one over the…

Solo
- 6,687
- 7
- 35
- 67
47
votes
4 answers
expressGraphQL is not a function
I am learning GraphQL for my project using this tutorial:
https://www.youtube.com/watch?v=ZQL7tL2S0oQ&ab_channel=WebDevSimplified
and I get the error:
TypeError: expressGraphQL is not a function
at Object.
I have already tried:
this…

Swantewit
- 966
- 1
- 7
- 19