Тёмный
Nils Hartmann
Nils Hartmann
Nils Hartmann
Подписаться
Ich bin Nils, freiberuflicher Software-Entwicker und Trainer aus Hamburg. Mehr Informationen über mich findest Du auf: nilshartmann.net.

Mal sehen, ob ich es schaffe, mehr als ein Video zu publizieren.

PS: Ich hatte mal einen Kanal, aber an den komme ich nicht mehr ran: ru-vid.com/show-UC8lIDpS7a-j1hIqPhMlwGoQ, deswegen geht's jetzt (Jan 2022) hier weiter.



Комментарии
@theparten
@theparten 2 месяца назад
great video❤, but i need to ask what's the best way on the client side who consumes the graphql api to know if the response is an error or not. Got used to REST where the http codes themselves are enough and now graphql seems a bit trickier.
@nils-hartmann
@nils-hartmann 2 месяца назад
actually http response codes doesn't play an important role in graphql communication (now), so you would only check for errors in your application by inspecting the result: either you have "data" or "errors" field (indicating a technical error) or both. If you have "data", then - depending on your schema - that field can contain "expected" errors (like field validation errors, unmet requirements etc.) There is a spec proposal "GraphQL over http" that would add some http status codes, but I'm unsure about the state of that draft (github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md)
@ahmadullahnikzad2850
@ahmadullahnikzad2850 5 месяцев назад
What are the advantages of react tanstack router than react router
@nils-hartmann
@nils-hartmann 5 месяцев назад
For me it's esp. the way you work with search params. I also like the typesafe routes, but not sure yet how really important they are in my apps. Also I like the loader api more than the one from react router, although I'm in general not a big fan of loading data in routes.
@raghavareddy246
@raghavareddy246 5 месяцев назад
please make a video on protected routes and public routes with signin, signup, 2fa,forgot password and reset password
@mr.daniish
@mr.daniish 5 месяцев назад
🎉 awesome video
@gastond7277
@gastond7277 6 месяцев назад
This was a very great intro (and more) of TanStack Router. Thank you for sharing!
@tchanos
@tchanos 6 месяцев назад
Nice examplanation, great video! Thanks alot! :)
@BoubkerBoulahdid
@BoubkerBoulahdid 6 месяцев назад
Clear explanation with great examples. Thank you!
@andyfitzgerald5341
@andyfitzgerald5341 8 месяцев назад
Very helpful, thank you.
@chhavitekriwal9608
@chhavitekriwal9608 Год назад
For making the handler functions run in parallel, do I need to do anything else other than making the backing function return a Mono object? I've done that but I don't know how to check whether they are indeed running in parallel. The @trace directive isn't returning anything and the response time is also the same (sometimes even more).
@nils-hartmann
@nils-hartmann Год назад
I've built the trace directive myself, not sure if it is working with newest Spring for GraphQL versions. I think the easiest is to use the TracingInstrumentation (www.graphql-java.com/documentation/instrumentation/#apollo-tracing-instrumentation) provided by graphql-java. You can create and instance yourself and return it from a Spring configuration @Bean method. Mono should work out of the box, maybe you need to configure the thread pool.
@pegahpasha1959
@pegahpasha1959 Год назад
Short and helpful
@samahgad241
@samahgad241 Год назад
Thank you, it was very clear and helpful💐
@GeekOverdose
@GeekOverdose Год назад
wow. this is amazing. thanks
@kumard3109
@kumard3109 Год назад
Good Explanation. Thanks a lot.
@GregPetersen-qu7zm
@GregPetersen-qu7zm Год назад
Thank Nils! Some useful stuff here!
@MalickbOued
@MalickbOued Год назад
Nicely done with care. Thank you again. Please upload more those viedeo
@eelessam
@eelessam Год назад
Great video! Hadn't been able to find any good documentation on doing this well with Spring for GraphQL
@kc_official
@kc_official Год назад
Thanks for the crisp and clear video. Would like to know how we can perform attribute name resolution? For example let's say graphql schema has attributes with snake_case and Java will be using camelCase, how we are going to setup the configuration to resolve this?
@nils-hartmann
@nils-hartmann Год назад
I'm not sure if there is an easy or generic way. There is the PropertyDataFetcher from graphql-java that is used if you don't register your own DataFetcher or resolver/mapping function for a field. That DataFetcher uses some naming conventions (java bean style). Maybe it would be somehow possible to write and register an own default datafetcher, but that might not be easy. If you only have a few cases where java attribute name does not match graphql field name, I would implement own SchemaResolver for that fields
@kc_official
@kc_official Год назад
@@nils-hartmann thanks for the reply, you are right. PropertyDataFetcher is the default one and following Java bean naming convention, but I was looking more generic way, like how we are going to mention the @JsonProperty annotation as part of our DTO or like @Column(name="") as part of the entity. It would be great, if you can have a video or article on the same how we are achieve that. I see in graphql-java-tools they were able to achieve the same with FieldResolverScanner. Is there any way we can use the same in Spring for GraphQL?
@Anbu_Sampath
@Anbu_Sampath 2 года назад
Curious to know how union types error response handled in client side. Because what concrete class object mapping handles both success and error response .
@nils-hartmann
@nils-hartmann 2 года назад
In general I see two options: first create a class that contains all fields from all union types you actually have included in your query. Something like this for the mutation from the video: // contains the fields you have selected in your query from Vet record VetResponse(String id) {} record AddVetResponse(VetResponse vet, String errorMessage) {} (mabye vet and errorMessage could be Optional's) Or you select also the __typename field in your query (mutation addVet(...) { __typename ...on AddVetSuccessPayload { ... } ...onAddVetFailedPayload { ... } }). The __typename field returns the name of the union type in your answer ("AddVetSuccessPayload" or "AddVetFailedPayload"). Based on the typename you can handle your response differently. For example using the execute-Method from Spring GraphQL's GraphQlClient Object (docs.spring.io/spring-graphql/docs/1.0.0-SNAPSHOT/reference/html/#client-requests-execute) you could first read the __typename field and then determine which field(s) you call the toEntity method for. It also might be that is easier to create an own Error-Object for the AddVetErrorPayload type (type AddVetErrorPayload { error: AddVetError }) if you have more than one field in the error type. This is definitley a place where code generators (like www.graphql-code-generator.com/ for TypeScript) would be helpful 😊 Hope that helps!
@Anbu_Sampath
@Anbu_Sampath 2 года назад
@@nils-hartmann Thanks, I will try and let you know how it goes.
@AnkurBhakta
@AnkurBhakta 2 года назад
Great video! Very clear and concise