graphql-framework-experiment icon indicating copy to clipboard operation
graphql-framework-experiment copied to clipboard

Could not find input type name: DateTime

Open sryeddula opened this issue 5 years ago • 4 comments

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?

}

sryeddula avatar Jul 29 '20 16:07 sryeddula

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!

fullstackstef avatar Jul 31 '20 17:07 fullstackstef

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

sryeddula avatar Aug 02 '20 11:08 sryeddula

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

Weakky avatar Aug 03 '20 16:08 Weakky

@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 ?

fullstackstef avatar Aug 03 '20 17:08 fullstackstef