Graphql 在prisma中表示没有id的类型的最佳方法是什么?
datamodel.graphqlGraphql 在prisma中表示没有id的类型的最佳方法是什么?,graphql,prisma,Graphql,Prisma,datamodel.graphql type Data { id: ID! @unique createdAt: DateTime! updatedAt: DateTime! points:[Point!]! } type Point { x:Float! y:Float! } 生成的类型(prisma.graphql): 在我的数据模型中,点是必填字段,但在生成的prisma类型中,点是可选的?当我更新数据点时,先前的数据也会出现在result()中 我看到的解决方法是
type Data {
id: ID! @unique
createdAt: DateTime!
updatedAt: DateTime!
points:[Point!]!
}
type Point {
x:Float!
y:Float!
}
生成的类型(prisma.graphql):
在我的数据模型中,点
是必填字段,但在生成的prisma类型中,点
是可选的?当我更新数据点时,先前的数据也会出现在result()中
我看到的解决方法是Json
,但我们在codegen和graphiql中放松了类型安全性:(
prisma是否会在实现中默认将类型
而不使用id
字段作为Json来处理
type Data implements Node {
id: ID!
points(where: PointWhereInput, orderBy: PointOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Point!]
}