Please for example how to use JSON type
generator prisma_client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model t {
id Int @default(autoincrement()) @id
val Json?
}
I need code of mutation.
I used answer from
GraphQL Mutation with JSON Patch
enabled crud
by
import { use } from 'nexus'
import { prisma } from 'nexus-plugin-prisma'
use(prisma({features:{crud:true}}))
and send this mutation:
mutation {
createOnet(data: {
val: "{ \"name\": \"michael\" }"
}) {
id
val
}
}
But I have response:
{
"error": [
{
"message": "Expected type Json, found \"{ \\\"name\\\": \\\"michael\\\" }\"; Cannot read property 'forEach' of undefined",
"locations": [
{
"line": 2,
"column": 26
}
]
}
]
}