learning-graphql | code samples for Learning GraphQL | GraphQL library
kandi X-RAY | learning-graphql Summary
kandi X-RAY | learning-graphql Summary
| | | |----------|----------| | ![Learning GraphQL Book Cover] | If you are ready to start building fullstack applications with GraphQL, Apollo, and React, this book is for you. In this book, Eve Porcello and Alex Banks provide a complete overview of GraphQL from the ground up which includes building your own full stack photo sharing application. Buy the book: [Amazon] - [O’Reilly] Take the Course: [GraphQL Workshop] |.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of learning-graphql
learning-graphql Key Features
learning-graphql Examples and Code Snippets
Community Discussions
Trending Discussions on learning-graphql
QUESTION
I had read through this great gist - GraphQLInterfaceType
But still have some confusions:
- Is that really necessary to define
ES6 classes
for all GraphQL schema types?- Main concern here is: we will end up with lots of empty
ES6 classes
and equivalent amount ofGraphQL types
.
- Main concern here is: we will end up with lots of empty
- If it is not, then how to handle the
resolveType
andisTypeOf
properly when use theinterfaces
features a lot? - Even I defined all the
ES6 classes
for all theGraphQL types
, but the raw data are constructed in different place with different tech likegrpc+protobuf
, which has no any relation to these classes definitions, so how does theisTypeOf: (value) => value instanceof Dog
work here?
ANSWER
Answered 2017-Apr-21 at 22:53The implementation of resolveType
and isTypeOf
is very flexible for a reason: it's extremely application-specific. It depends on the database, the data models, how similar the types are, and so on. Some backends might have separate ES6 classes for all their models, especially if using an ORM, where it creates instances of those classes when you query the database. But an ORM is not necessary. And you shouldn't be required to instantiate any other classes to figure out the GraphQL type.
In some cases, you can determine the type solely from the properties on the objects. If this isn't the case for your app, there are things you can do to give hints. Here is a SQL example.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install learning-graphql
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page