I see for Apollo graphql if i wan to use plain Apollo subscription, I can import PubSub from Apollo-server or graphql-subscription . Wondering which one is correct to use ?
Take look at the dependencies of apollo-server.
graphql-subscriptions is the dependency of apollo-server.
apollo-server just re-exports all modules from graphql-subscriptions without modifying anything.
So, you can import PubSub from any package. They are the same.
Related
In NestJS application, right now I am using class-validator to validate DTO and request payload. Is there any benefits if I shift to #nestjs/class-validator?
I found both packages are same.
#edited
Later I found #nestjs/class-validator is maintained by nestjs which is especially designed for nestjs projects.
And #nestjs/class-validator is more updated/maintained one.
as of now, #nestjs/class-validator is just a fork to keep class-validator dependencies up to date.
You can see all of non-updates changes here: https://github.com/nestjs/class-validator/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Amerged+-author%3Aapp%2Frenovate+-author%3Aapp%2Fdependabot+
It is possible allow auto schema file generation (autoSchemaFile) in nestjs only for one resolver?
I would like to have one autogenerated scheme and rest of is written manually.
Thank you.
I found out about DataLoader package reading GraphQL tutorial but all of the examples for DataLoader package corresponds to some databases.
Does it make sense to use DataLoader if my GraphQL layer is just a layer on top of the REST API?
I have a graphql API written using graphql-java-tools and graphql-java. I want to mock a query operation. How can I do this? Is Apollo graphql-tools the only way to achieve this. I havent used any other apolo library in my project yet and didnt want to go that route for just mocking service.
There is no library that supports mocking in java as of now( Apollo-graphql-tools supports only nodejs). I think best way is to mock it yourself creating new objects.
I'm trying to build a mocking infrastructure for our react client. Getting confused between the two.
buildClientSchema vs makeExecutableSchema
makeExecutableSchema can be used to mock schema types, resolvers, logger, etc...
buildClientSchema can only be used to mock the schema types, but cannot be used to execute queries/mutations.
If you want to mock and test the return (query) data use makeExecutableSchema if is just to test the schema type definitions use buildClientSchema.
It always comes into what you need to test.