我尝试了一些变体,但没有运气在 GraphQL 中返回地图。所以我有以下两个对象:
public class Customer {
private String name, age;
// getters & setters
}
public class Person {
private String type;
private Map<String, Customer> customers;
// getters & setters
}
我的架构如下所示:
type Customer {
name: String!
age: String!
}
type Person {
type: String!
customers: [Customer!] // Here I tried all combination but had no luck, is there a Map type support for GQL?
}
有人可以告诉我如何实现这一点,以便 GraphQL 神奇地处理这个或替代方法。
非常感谢!