相关疑难解决方法(0)

在多种类型上使用GraphQL Fragment

如果我的GraphQL架构中有多个类型共有的字段集,有没有办法做这样的事情?

type Address {
  line1: String
  city: String
  state: String 
  zip: String
}

fragment NameAndAddress on Person, Business {
  name: String
  address: Address
}

type Business {
   ...NameAndAddress
   hours: String
}

type Customer {
   ...NameAndAddress
   customerSince: Date
}
Run Code Online (Sandbox Code Playgroud)

apollo graphql

13
推荐指数
2
解决办法
3847
查看次数

标签 统计

apollo ×1

graphql ×1