prisma-labs / graphql-framework-experiment

Code-First Type-Safe GraphQL Framework
https://nexusjs.org
MIT License
675 stars 66 forks source link

Could not find input type name: DateTime #1307

Open sryeddula opened 4 years ago

sryeddula commented 4 years ago

when I have auto generated DateTime inputType(ExpenseCreateInput!) I am getting the error saying 'Could not find input type name: DateTime' during Prisma insert. for example mutation like t.crud.createOneExpense(). Full stack trace is

Stack: at DmmfDocument.getInputTypeWithIndexedFields (~/workspace/pec-prisma-api/node_modules/nexus-plugin-prisma/src/schema/dmmf/DmmfDocument.ts:53:13) at transformNullsToUndefined (~/workspace/pec-prisma-api/node_modules/nexus-plugin-prisma/src/schema/null.ts:32:37) at Object.transformNullsToUndefined (~/workspace/pec-prisma-api/node_modules/nexus-plugin-prisma/src/schema/null.ts:34:26) at originalResolve (~/workspace/pec-prisma-api/node_modules/nexus-plugin-prisma/src/schema/builder.ts:328:24) at resolve (~/workspace/pec-prisma-api/node_modules/nexus-plugin-prisma/src/schema/builder.ts:354:21) at field.resolve (~/workspace/pec-prisma-api/node_modules/graphql-extensions/src/index.ts:274:18) at field.resolve (~/workspace/pec-prisma-api/node_modules/apollo-server-core/src/utils/schemaInstrumentation.ts:103:18) at resolveFieldValueOrError (~/workspace/pec-prisma-api/node_modules/graphql/execution/execute.js:467:18) at resolveField (~/workspace/pec-prisma-api/node_modules/graphql/execution/execute.js:434:16) at ~/workspace/pec-prisma-api/node_modules/graphql/execution/execute.js:244:18

prisma model


model Expense { id String @default(cuid()) @id date DateTime? category String? description String? amount Float?

}

fullstackstef commented 4 years ago

Hey @sryeddula - just to confirm, you are having this issue when you are passing data into the date parameter?

I'm falling into the same issue, but looking at the documentation you might need to import the type via schema.importType() and add a library to support the DateTime type with graphql-iso-date.

You can reference the docs here.

Also, I'm not an official contributor so I could be mistaken, but I hope this helps!

sryeddula commented 4 years ago

@fullstackstef Thank you so much for the answer. My issue is related tp prisma.crud, where I wouldn't be able to change inputObject

Weakky commented 4 years ago

Hey folks, would you mind trying to install nexus-plugin-prisma@next? I believe this is fixed but wasn't released on stable yet

fullstackstef commented 4 years ago

@Weakky Installed, but would we have to still use something like graphql-iso-date to pass a specific date as an argument while following the doc in regards to importType ?