Prisma-client-js: Can't create record with Json

Created on 6 May 2020  路  2Comments  路  Source: prisma/prisma-client-js

Schema

model User {
  id      Int      @default(autoincrement()) @id
  email   String   @unique
  name    String?
  json    Json?
}

Client call

  const user = await client.user.create({
    data: {
      email: '[email protected]',
      json: {
        hello: 'world',
      },
      name: 'Bob',
    },
  })

Error

Error parsing GraphQL query: query parse error: Parse error at 5:7
Unexpected `"hello"[StringValue]`
Expected `Name`, `:` or `}`
bu2-confirmed kinbug tectypescript

Most helpful comment

@aguilera51284 Yes, you can try out the fix in the alpha release npm install @prisma/cli@alpha @prisma/client@alpha && npx @prisma/cli@alpha generate

All 2 comments

this issue has fixed?

@aguilera51284 Yes, you can try out the fix in the alpha release npm install @prisma/cli@alpha @prisma/client@alpha && npx @prisma/cli@alpha generate

Was this page helpful?
0 / 5 - 0 ratings