Mental model behind creation of Apollo schema?

In the GraphQL Asia Workshop Apollo schema definition the schema deviates from the autogenerated schema generated by graphqlgen and the Dgraph schema itself.
This occurs kind of in a “black box” way and no rationale is provided for changing the schema itself.
Could the mental model and process please be explained, as this would make the process of integrating apollo much easier?

Thanks!

Are you talking about how it deviates from the inputted dgraph schema found here: graphql-asia-workshop-2020/dgraph.graphql at master · dgraph-io/graphql-asia-workshop-2020 · GitHub?

Yes, It is different than that schema. I understand that the mutations are selectively exposed, but the model for individual types is also divergent, without much explanation.

The problem with this, is that seemingly the custom resolvers implemented via schema augmentation don’t work when using autogenerated types, and i’d like to understand why and how i should go and develop against apollo. Specifically if as a developer i should have two schemas, one for dgraph and one for apollo, and have both of them manually created, and divergent.

To be clear, i want to understand the WHY this is different, and why it couldnt simply be the autogenerated SDL exposed by the dgraph server.

1 Like

pinging @vardhanapoorv as he knows this discussion :slight_smile:

Hi @davidLeonardi
The main reason to use Apollo in that case was we wanted to selectively expose the mutation so that the frontend can’t execute those and to have some logic before we send the mutation/query to Dgraph hence you see that the input to the queries/mutations is also different because few of them are computed on the Apollo server and then sent.
Now with custom logic and auth we can do most of these things with the Dgraph GraphQL schema itself, having said that I will soon be writing a blog(will include the steps and try to answer all your points in more depth) and sharing the examples around usage of Apollo federation and server in general with Dgraph GraphQL. We have some more content which should be coming in next few weeks.
Hope this clears it a bit.

1 Like

Can’t wait for that blog post!
Covering federation and in general integration with apollo is something i look forward to learning about!

1 Like