【发布时间】:2019-11-09 20:06:25
【问题描述】:
Json 到 GraphQLArgumetn 对象转换在 graphql-spqr 中失败。
尝试将 GraphQLInterface(具有自动发现和扫描包)添加到上述抽象类 和 GraphQLtype 类型所有具体类。
我的图表查询:
query contactsQuery($searchQuery : QueryInput) { contacts(searchQuery:$searchQuery){id}}
variables:{"searchQuery":{"bool":{"conditions":[{"must":{"matches":[{"singleFieldMatch":{"boost":null,"field":"firstname","value":"siddiq"}}],"bool":null}}]}})
Java 代码:
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME,include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({@type(value = Must.class, name="must"),@type(value = MustNot.class, name="mustNot")})
public abstract class Condition
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME,include=JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({@type(value = SingleFieldMatch.class, name="singleFieldMatch"),@type(value = MultiFieldMatch.class, name="multiFieldMatch")})
public abstract class Match
@GraphQLQuery(name = "contacts")
public List getContacts(@GraphQLArgument(name ="searchQuery") Query query)
仍然抛出错误未知字段错误等。不确定缺少哪个配置。 使用 AnnotatedResolvedBuilder 构建 GraphQLSchema,基础包配置 JacksonValueMappperFactory 和单例服务。
【问题讨论】:
标签: java json graphql-spqr