Nexus-plugin-prisma: Input Object type <ONLYIDSMODEL>UpdateManyDataInput must define one or more fields

Created on 21 Aug 2020  路  2Comments  路  Source: graphql-nexus/nexus-plugin-prisma




Screenshot

image

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

Most helpful comment

how about this? I'm facing this issue when create explicit many-to-many relation in prisma.

All 2 comments

I really appreciate the hot fix to this problem. definitely there is something wrong going on.

Screenshot

image

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

malekjaroslav picture malekjaroslav  路  5Comments

marticrespi picture marticrespi  路  4Comments

lterfloth picture lterfloth  路  5Comments

RAW4RMCS picture RAW4RMCS  路  3Comments

antonbramsen picture antonbramsen  路  4Comments