nexus-plugin-prisma
nexus-plugin-prisma copied to clipboard
Input Object type <ONLYIDSMODEL>UpdateManyDataInput must define one or more fields
Screenshot

Description
If a model doesn't have any scalar fields (only own id and other relation ids), like in the OrganizationProfileGroup, then some types generated for update many resolvers of this model are empty. So when I try to run my server I get the input type errors that you can see in the screenshot.
Here's my schema.graphql
file generated by nexus with the empty inputs:
input OrganizationResourceGroupUpdateManyDataInput
input OrganizationResourceGroupUpdateManyMutationInput
As a workaround for now I am overwriting the faulty input types with a dummy field in the input by doing:
export const OrganizationProfileGroupUpdateManyDataInput = inputObjectType({
name: 'OrganizationProfileGroupUpdateManyDataInput',
definition: (t) => {
t.int('_', { required: false });
}
});
export const OrganizationProfileGroupUpdateManyMutationInput = inputObjectType({
name: 'OrganizationProfileGroupUpdateManyMutationInput',
definition: (t) => {
t.int('_', { required: false });
}
});
Then my generated inputs look like this:
input OrganizationResourceGroupUpdateManyDataInput {
_: Int
}
input OrganizationResourceGroupUpdateManyMutationInput {
_: Int
}
And the issue is gone.
I think my issue is related to this: https://github.com/graphql-nexus/nexus-plugin-prisma/issues/648
I really appreciate the hot fix to this problem. definitely there is something wrong going on.
Screenshot
#### Description
If a model doesn't have any scalar fields (only own id and other relation ids), like in the OrganizationProfileGroup, then some types generated for update many resolvers of this model are empty. So when I try to run my server I get the input type errors that you can see in the screenshot.
Here's my
schema.graphql
file generated by nexus with the empty inputs:input OrganizationResourceGroupUpdateManyDataInput input OrganizationResourceGroupUpdateManyMutationInput
As a workaround for now I am overwriting the faulty input types with a dummy field in the input by doing:
export const OrganizationProfileGroupUpdateManyDataInput = inputObjectType({ name: 'OrganizationProfileGroupUpdateManyDataInput', definition: (t) => { t.int('_', { required: false }); } }); export const OrganizationProfileGroupUpdateManyMutationInput = inputObjectType({ name: 'OrganizationProfileGroupUpdateManyMutationInput', definition: (t) => { t.int('_', { required: false }); } });
Then my generated inputs look like this:
input OrganizationResourceGroupUpdateManyDataInput { _: Int } input OrganizationResourceGroupUpdateManyMutationInput { _: Int }
And the issue is gone.
I think my issue is related to this: #648
how about this? I'm facing this issue when create explicit many-to-many relation in prisma.
Just got this issue too. Any updates on this?