[英]UnhandledPromiseRejectionWarning: Error: Type Query must define one or more fields
[英]Define more than one type of query GraphQL Schema - Best approach to define different types on query one one object
这是否可以在一个模式中指定不止一种类型的查询?
type Query {
productsByRegion(match : String) : [Product]
productsByType(match : String) : [Product]
}
type Product {
id: ID
name: String
}
可以使用单个模式定义触发的预期查询:
{
productsByRegion {
id
name
}
}
{
productsByType {
id
name
}
}
GraphQL java 实现缓存了一些数据。 服务器后,重新启动两个查询都可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.