数据模型.graphql
type Data {
id: ID! @unique
createdAt: DateTime!
updatedAt: DateTime!
points:[Point!]!
}
type Point {
x:Float!
y:Float!
}
生成的类型(prisma.graphql):
type Data implements Node {
id: ID!
points(where: PointWhereInput, orderBy: PointOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Point!]
}
在我的数据模型points
中是必填字段,但在生成的棱镜类型points
中是可选的?当我更新我的数据点时,以前的数据也会出现结果(https://github.com/prisma/prisma/issues/1657)..
我看到的解决方法是Json
,但我们在 codegen 和 graphiql 中失去了类型安全性:(,
默认情况下, prisma 是否会在type
没有id
字段的情况下作为 Json 处理......?