小编Vin*_*nod的帖子

environment.getArgument 无法在 graphql-java 中转换为我自己的 java 对象

由于以下错误 ExecutionStrategy.resolveField() - Exception while fetching data java.lang.ClassCastException: java.util.LinkedHashMap incompatible with com.fathome.graphql.OffersDto

OffersDto inputObject = environment.getArgument("offersInput");

请让我知道下面的代码有什么问题,提前致谢。

package com.fathome.graphql;

import graphql.schema.*;

import static graphql.Scalars.*;
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import static graphql.schema.GraphQLInputObjectField.newInputObjectField;
import static graphql.schema.GraphQLInputObjectType.newInputObject;
import static graphql.schema.GraphQLList.list;
import static graphql.schema.GraphQLObjectType.newObject;


public class ManualGraphQLQuerySchema {


    public static GraphQLObjectType offersResponse = newObject()
            .name("OffersResponse")
            .field(newFieldDefinition()
                    .name("offerName")
                    .type(GraphQLString))
            .field(newFieldDefinition()
                    .name("offerId")
                    .type(GraphQLString))
            .build();

    public static GraphQLInputObjectType offersRequestType = GraphQLInputObjectType.newInputObject()
            .name("OffersDto")
            .field(newInputObjectField()
                    .name("offerName")
                    .type(GraphQLString))
            .field(newInputObjectField()
                    .name("offerId")
                    .type(GraphQLString))
            .build();

    public static GraphQLObjectType queryType = newObject()
            .name("QueryType")
            .field(newFieldDefinition()
                .name("offers") …
Run Code Online (Sandbox Code Playgroud)

java graphql graphql-java

4
推荐指数
1
解决办法
1487
查看次数

标签 统计

graphql ×1

graphql-java ×1

java ×1