graphql - 在 prisma 中表示没有 id 的类型的最佳方法是什么?
问题描述
数据模型.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 处理......?
解决方案
推荐阅读
- sql - 在 SQL CASE 中评估无结果条件
- python - matplotlib funcanimation 返回艺术家对象列表错误:“列表没有属性 set_animated”
- gradle - 在 Gradle Idea 插件中设置工作区和项目文件的输出文件夹
- entity-framework - EF Core 多对多关系表命名
- c - 当 gslcblas 库不在 /usr/local/lib 中时,链接到这些库的正确标志是什么?
- javascript - 通过覆盖查找列表对数组进行排序
- javascript - 渲染不同组件时的钩子顺序错误
- jenkins - 如何根据另一个参数的条件创建可编辑参数?
- hibernate - Grails 中的条件嵌套关联
- python - 从 Sqlite3 输出列表中读取