Stitching secure subscriptions using makeRemoteExecutableSchema

I have one working solution: the idea is to not create one instance of SubscriptionClient for the whole application. Instead, I’m creating the clients for each connection to the proxy server: server.start({ port: 4000, subscriptions: { onConnect: (connectionParams, websocket, context) => { return { subscriptionClients: { messageService: new SubscriptionClient(process.env.MESSAGE_SERVICE_SUBSCRIPTION_URL, { connectionParams, reconnect: true, }, ws) … Read more

Using GraphQL Fragment on multiple types

Fragments are only used on the client-side when making requests — they can’t be used inside your schema. GraphQL does not support type inheritance or any other mechanism that would reduce the redundancy of having to write out the same fields for different types. If you’re using apollo-server, the type definitions that make up your … Read more

GraphQL : the object name is defined in resolvers, but not in schema

Couple of things to fix here. First, to use an object as an argument, you have to define it as an input (or GraphQLInputObjectType) in your schema — you cannot use a regular type (or GraphQLObjectType) as an argument. So your type definitions need to look something like this: type Mutation { agreementsPost(agreement: Agreement): String … Read more

Support of aggregate function in GraphQL

GraphQL, at the end of the day, responds with your defined types. You just need to put that data into a type. Whether this is a specific type for these different queries, or fields for that data on existing types, it’s up to you but that’s all it boils down to. GraphQL does require more … Read more

How to chain two GraphQL queries in sequence using Apollo Client

The props added by your firstQuery component will be available to the component below (inside) it, so you can do something like: export default compose( graphql(firstQuery, { name: ‘firstQuery’ }), graphql(secondQuery, { name: ‘secondQuery’, skip: ({ firstQuery }) => !firstQuery.data, options: ({firstQuery}) => ({ variables: { var1: firstQuery.data.someQuery.someValue } }) }) )(withRouter(TestPage)) Notice that we … Read more

What does the “operation name” reference?

In GraphiQL you can choose from a list of queries specified by the operation name. Here’s some screenshots to help make this make sense. When you have two mutations / queries side-by-side and they don’t have an operation name you can’t run them. When they have operation names they can be listed when you click … Read more

Result of a delete mutation?

I don’t think a clear de facto standard exists as of July, 2017, and I see a lot of differences between implementations (GitHub, Yelp, GraphCool, Shopify). However, if you look at some of recent GraphQL APIs to come out, there seems to be a common trend. Largely, the input type and response type are specific … Read more

What is the difference between GraphQL and SPARQL?

Context Datatourisme is a platform that allows to publish (via the Producteur component) and to consume (via the Diffuseur component) POI-related open data. It seems you have linked to a particular application developed over Diffuseur with a help of GraphQL Voyager. The application illustrates capabilities of the GraphQL API exposed by Diffuseur. The API documentation … Read more

graphql, union scalar type?

Scalars can’t be used as part of unions, since per the specification, unions specifically “represent an object that could be one of a list of GraphQL Object types.” Instead, you can use a custom scalar. For example: const MAX_INT = 2147483647 const MIN_INT = -2147483648 const coerceIntString = (value) => { if (Array.isArray(value)) { throw … Read more