Questions tagged [graphql-js]

The JavaScript reference implementation for GraphQL, a query language created by Facebook for describing data requirements on complex application data models.

1291 questions
77
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,249
  • 2
  • 11
  • 16
72
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
  • 40,521
  • 63
  • 217
  • 426
67
votes
5 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
  • 1,519
  • 3
  • 13
  • 22
64
votes
5 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
  • 912
  • 1
  • 6
  • 13
60
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
  • 910
  • 8
  • 15
53
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
  • 2,998
  • 1
  • 18
  • 33
42
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
  • 28,073
  • 81
  • 228
  • 405
41
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
  • 40,521
  • 63
  • 217
  • 426
40
votes
1 answer

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
  • 728
  • 2
  • 8
  • 18
40
votes
7 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
  • 532
  • 1
  • 10
  • 25
38
votes
1 answer

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,171
  • 9
  • 31
  • 41
38
votes
1 answer

When to use GraphQLID instead of GraphQLInt?

It is not clear when to use GraphQLID instead of GraphQLInt. Consider the following schema: type User { id: Int! firstName: String! lastName: String! } type Query { user (id: ID!): User } In case of Query.user, it seem to make no…
Gajus
  • 55,791
  • 58
  • 236
  • 384
36
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
  • 2,837
  • 3
  • 19
  • 48
35
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
  • 355
  • 1
  • 3
  • 6
33
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
  • 5,383
  • 3
  • 25
  • 57
1
2 3
85 86