You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because of that @link field, we need to be able to resolve that type in such a way that the parent type passed into the resolver is not the same type that the resolver will eventually hand back to the client. So we've been adding mappers to our codegen.yml:
This is all fine right now, but it seems to be a lot of boilerplate code just to get interfaces and implementing types to resolve properly, and furthermore be able to define things like relations or "virtual" fields that aren't backed by a database. As such, we feel that we're going to have a lot of types that end up this way, so we were looking to do this in a slightly more sustainable way. Is there any way to basically "default" the resolvers types to use *DbObject types generated by typescript-mongodb?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We're using the following plugins:
Our GraphQL schema has a lot of types that look something like this:
Because of that
@link
field, we need to be able to resolve that type in such a way that the parent type passed into the resolver is not the same type that the resolver will eventually hand back to the client. So we've been adding mappers to our codegen.yml:This allows us to write a resolver like so:
This is all fine right now, but it seems to be a lot of boilerplate code just to get interfaces and implementing types to resolve properly, and furthermore be able to define things like relations or "virtual" fields that aren't backed by a database. As such, we feel that we're going to have a lot of types that end up this way, so we were looking to do this in a slightly more sustainable way. Is there any way to basically "default" the resolvers types to use
*DbObject
types generated by typescript-mongodb?Beta Was this translation helpful? Give feedback.
All reactions