From a junior dev perspective: I watched this video about a few months back and sort of understood it and I re-watched it again today and it makes complete sense. I just wanted to take the time to say thank you so much for this, Ben!
@akasadulloh33932 жыл бұрын
O men thank you so much. It's hard to find docs about union types usage. It's very helpful!
@prvnbist5 жыл бұрын
Hey, Really nice tutorial about Union Types. Could you also do one for Enums whenever it's convenient for you?
@bawad5 жыл бұрын
sure
@sanchito594 жыл бұрын
Great video, thanks for this!
@sasonbraha45995 жыл бұрын
Awesome video! thanks.
@kamleshshete69483 жыл бұрын
Thanks for the tutorial and I watched many other Ur tutorial ..... Great work .Thank you very much Ben I have one question can we give multiple scalar type for fields in schema Like type user name : Int I String l Date } Is it possible to give multiple scale types ???
@kamleshshete69483 жыл бұрын
And my second question is Graphql is it have really have performance and other benefits over rest API for small applications with 1k or 10k users ? And many cases need third party library support , ex: for file upload We can't test directly from GraphQL playground need to install some third party library ?
@iljushka71985 жыл бұрын
Used it once for search feature
@yoyo26-345 жыл бұрын
Hi, thks but I guess it would me more powerfull if the union type returns the same fields names whatever the error type is triggered. Would be much easier on the client side to manager the errors. All in all this is all about standardizing the errors signatures thks ben
@akashrajpurohit975 жыл бұрын
What would you do while implementing the client side of it. Because you are not sure whether you will get an error object with reason or with field key on it. Would you have to keep a check something like if(err && err.field) validationErrorRes if(err && err.reason) timeoutErrorRes Something like this or different sol?
@bawad5 жыл бұрын
yes or you can check the __typename
@akashrajpurohit975 жыл бұрын
@@bawad Cool
@anikethsaha50645 жыл бұрын
Can they b used for auth? Like if my auth attempt is correct then return the user else the error?...
@bawad5 жыл бұрын
yes
@natture4 жыл бұрын
how is that toggling happing can anyone tell i
@bawad4 жыл бұрын
Toggling between screens? That's control + left or right arrow key on mac
@riginoommen4 жыл бұрын
How to use unions with input types
@AsifIqbalR4 жыл бұрын
You can't.
@franciscobanda52135 жыл бұрын
Hi Ben, How would I structure my resolvers const for the following scenario? My schema looks likes this: const schema = gql ` type Query { search(text: String!): [SearchResults!] union SearchResults = User | Transaction | Message type User { logonID: ID! fullName: String! surName: String! } type Transaction{ transactionType: String platformName: String } type Message{ fullText: String! description: String! } ` const resolvers = { Query : { search: () => { } }, SearchResults: { __resolveType: obj => { if(obj.logonID){ return "User" } if(obj.transactionType){ return "Transaction" } if(obj.fullText){ return "Message" } return null } } }
@franciscobanda52135 жыл бұрын
I understand that for each Union Type there needs to be a resolveType to distinguish which data type will come back however I'm unclear as to how initial Query Resolver connects to it.
@bawad5 жыл бұрын
what do you mean by the initial query resolver? like your unsure what your search resolver should look like?