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
Is your feature request related to a problem? Please describe.
Use generated resolver type in regular mappers.
Describe the solution you'd like
This suggestion builds on the features introduced in #1593.
The changes means that there are now special resolver return/parent types generated for all schema types, and these types are returned by default by resolvers. Also these resolver types are defined in each other by default, so one resolver type has fields of the other resolver types rather than the raw schema types.
However if we introduce a mapper it will break the chain of resolver types referencing each other as noted in this comment and this comment.
To solve the above, perhaps we can introduce a parameter to the regular mappers the same way that the default mapper now have a parameter {T}. In the case or regular mappers the parameter would be the default generated type.
Now we want to make MyType partial without breaking the chain of referencing resolver types. If mappers had a parameter which gave the default generated resolver type we could have this config:
pluginsconfig:
mappers:
MyType: Partial<{T}>
In this example the {T} would be Omit<MyType, 'otherType'> & { otherType: Maybe<ResolversTypes['MyOtherType']> } since that is the generated resolver-type. The output from this would be:
Is your feature request related to a problem? Please describe.
Use generated resolver type in regular mappers.
Describe the solution you'd like
This suggestion builds on the features introduced in #1593.
The changes means that there are now special resolver return/parent types generated for all schema types, and these types are returned by default by resolvers. Also these resolver types are defined in each other by default, so one resolver type has fields of the other resolver types rather than the raw schema types.
However if we introduce a mapper it will break the chain of resolver types referencing each other as noted in this comment and this comment.
To solve the above, perhaps we can introduce a parameter to the regular mappers the same way that the default mapper now have a parameter
{T}
. In the case or regular mappers the parameter would be the default generated type.Let's say by default we have this:
Now we want to make
MyType
partial without breaking the chain of referencing resolver types. If mappers had a parameter which gave the default generated resolver type we could have this config:In this example the
{T}
would beOmit<MyType, 'otherType'> & { otherType: Maybe<ResolversTypes['MyOtherType']> }
since that is the generated resolver-type. The output from this would be:The text was updated successfully, but these errors were encountered: