1

I am Newbie to Graphql-Java, I am trying to load two *.graphqls file as array in to schema. Each schema has separate query defined. After server startup, I see only the query in last file got exposed. My code below.

A.graphqls

type Query{
    queryOne(param : Param) : ResponseOne
    queryTwo(param : Param) : ResponseTwo
}

B.graphqls

type Query{
    queryThree(param : Param, param1 : Param1) : ResponseThree
}

I see only "queryThree" got exposed.

I am loading like below.

        String[] graphlList = new String[]
      {"graphqls/A.graphqls","graphqls/B.graphqls"};

        GraphQLSchema gSchema = null;
        SchemaParser schemaFile = SchemaParser.newParser()
                .files(graphlList)
                .resolvers(
                    all resolvers go here
                ).dictionary(
                        all Directory  go here
                    ).scalars(
                        all userdefined scalar defined here.
                    ).build();

            gSchema = schemaFile.makeExecutableSchema();
            return gSchema;

Please highlight, where I am making wrong.

1 Answer 1

2

I think you're missing the extend keyword in the second schema, so it overrides the definition from the first.

extend type Query{
    queryThree(param : Param, param1 : Param1) : ResponseThree
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.