Skip to content
Graffle is a work in progress. Learn more.

Root Fields generated client

Every root field (aka. entrypoint) in the GraphQL schema is made available as a method on the generated client. Root fields are any field on the root types: Query, Mutation, and Subscription.

For example the pokemon schema has this root field:

graphql
type Mutation {
  addPokemon(attack: Int, defense: Int, hp: Int, name: String!, type: PokemonType!): Pokemon
	# ...
}

Then the generated client would include a addPokemon method.

ts
const 
result
= await
pokemon
.mutation.addPokemon({
$
: {
name
: 'Charmander',
$type
: 'fire',
},
name
: true,
})

Example

Released under the MIT License.