Search code examples
javagraphqlgraphql-java

How to create GraphQL object with arguments?


Is it possible an object with arguments? In other words, can I create an object for running queries like this?

{
    artifact(group: "com.graphql-java", name: "graphql-java") {
        group
        name
        version
    }
}

If yes, how?

I couldn't find a method for creating arguments in graphql.schema.GraphQLObjectType.newObject.


Solution

  • Call field() on the Builder to add an argument.