GraphQL: Non-nullable array/list

Non-null means exactly what it sounds like — not null. An empty array is not null — it’s still returning a value. Here is a summary table: declaration accepts: | null | [] | [null] | [{foo: ‘BAR’}] ———————————————————————— [Vote!]! | no | yes | no | yes [Vote]! | no | yes | yes … Read more

graphqlHTTP is not a function

Look at the documentation: const { graphqlHTTP } = require(‘express-graphql’); Note that it uses destructuring equivalent to: const graphqlHTTP = require(‘express-graphql’).graphqlHTTP; require(‘express-graphql’) returns an object with a property called graphqlHTTP that is the function you want to call. You’re trying to call the object itself as if it was a function.

How do you extend types in GraphQL?

Starting with the June2018 stable version of the GraphQL spec, an Object type can extend another Object type: Object type extensions are used to represent a type which has been extended from some original type. For example, this might be used to represent local data In your example, type Animal { species: String } extend … Read more

GraphQL Error field type must be Input Type but got:

In GraphQL, an input cannot be used as a type and a type cannot be used as an input. Unfortunately, even if the fields appear identical to an existing type, you always have to define a separate input to use as an argument. Try something like this: const NotebookDetailsInput = new GraphQLInputObjectType({ name: ‘NotebookDetailsInput’, fields: … Read more

OData vs GraphQL [closed]

I have researched and also tried with Both GraphQL in Dot Net and Odata in DotNet Web API to create a working demo and What I found are Developer Usability Considering you have existing WebAPI(DotNet Framework) and want to migrate to GraphQL or OData compatible WebAPI then my answer is to choose OData because of … Read more

Apollo GraphQL React – how to query on click?

You can do it by passing a reference to Apollo Client using the withApollo higher-order-component, as documented here: https://www.apollographql.com/docs/react/api/react-apollo.html#withApollo Then, you can call client.query on the passed in object, like so: class MyComponent extends React.Component { runQuery() { this.props.client.query({ query: gql`…`, variables: { … }, }); } render() { … } } withApollo(MyComponent); Out of … Read more