-
-
Notifications
You must be signed in to change notification settings - Fork 94
Refactor resolver creation #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
…er without resolvers. Now Resolvers can be generated on-demand in such way `PostTC.generateResolver.findMany()` (before was `PostTC.getResolver('findMany')`). related #263
@toverux how do you think - PostTC.addRelation('reviewers', {
resolver: UserTC.generateResolver.dataLoaderManyLean(), // <------ added `generateResolver` with all resolvers
prepareArgs: {
_ids: (s) => s.reviewerIds, // <------- `s` infers its type `IPost` automatically
},
projection: { reviewerIds: true },
}); The whole example you may see above. |
Awesome work! Increased type safety and performance will be much welcomed.
I'd rather call it something like But you may also want to give it a name that is specific to graphql-compose-mongoose, right? Like
That looks exciting! I see a new dataLoaderManyLean ; I'm curious, what are the other ones and will there be non-lean variants (if that's what I think it is, ie. mongoose lean documents, maybe we could configure that with a |
@toverux Yep, I also dislike |
If our app is using different data sources so visibility will be greatly improved for developers with `UserTC.mongooseResolvers.find()`, `UserTC.elasticResovers.find()`. see #263 (comment)
…er without resolvers. Now Resolvers can be generated on-demand in such way `PostTC.generateResolver.findMany()` (before was `PostTC.getResolver('findMany')`). related #263
If our app is using different data sources so visibility will be greatly improved for developers with `UserTC.mongooseResolvers.find()`, `UserTC.elasticResovers.find()`. see #263 (comment)
You may try a new version v9.0.0-alpha.6. In v9 will be kept to ways of generation TypeComposer via
I suppose that you'll very like graphql-compose-mongoose/src/__tests__/github_issues/141-test.ts Lines 163 to 174 in a136386
@toverux Please take a look. If you will have any ideas for issues - please let me know. |
…ddition to basic resolvers related: #263 (comment) closes #266 related #140
…ddition to basic resolvers related: #263 (comment) closes #266 related #140
@toverux can I ask you to review release notes for v9.0.0? If you will have any questions, additions, or fixes – please write them here (or you may make fixes via PR for the |
This discussion was started here: graphql-compose/graphql-compose#281 (comment)
I was working under a new major version of
graphql-compose-mongoose
in my free time. And there was added 8 new resolvers and two old resolvers were changed with breaking changes. So according to these changes, I feel that storing resolvers in ObjectTypeComposer has the following disadvantages:go-to
support in IDE via ctrl+click for opening resolver definitionThere is a long way but something already has done:
source: Model<IDoc>
composeMongoose
which does not generate resolvers.mongooseResolvers
property to TypeComposer with resolver generators. And when you need a resolver you may generate it in such wayPostTC. mongooseResolvers.findMany()
(before wasPostTC.getResolver('findMany')
).And for now looks so:
UPD: in the code above
generateResolver
was renamed tomongooseResolvers
.The text was updated successfully, but these errors were encountered: