简体   繁体   English

突变 GraphQL map 一个数组到 java.util.Set

[英]Mutation GraphQL map an Array to java.util.Set

With spring-graphql 1.0.1, I am trying to map an array of String [String] to a SortedSet in a GraphQL Mutation but I get an error.使用 spring-graphql 1.0.1,我正在尝试将 map String [String]数组转换为 GraphQL Mutation 中的SortedSet ,但出现错误。

Property referenced in indexed property path 'names[0]' is neither an array nor a List nor a Map;索引属性路径“names[0]”中引用的属性既不是数组也不是列表也不是 Map; returned value was [[]]返回值为 [[]]

How to specify the conversion from a String array of a Input type to a SortedSet?如何指定从 Input 类型的 String 数组到 SortedSet 的转换?

Here is my schema.graphqls这是我的schema.graphqls

type Mutation {
    save(person: PersonInput): Person
}

input PersonInput {
    id: String
    names: [String]
}

Type Person {
    id: String
    names: [String]
}
@Data
public class Person {
  private String id;
  private SortedSet names;
}

The mutation Query:突变查询:

mutation {
    save( person: {  id: "1", names: ["A","B"]} ){
        id
        names
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM