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

Pokemon Schema

This is the GraphQL schema used in all examples throughout the Graffle documentation. It is provided here for reference. For example you may want to keep it open to the side as you study various examples to better understand their context.

You can find its implementation in the repo at tests/_/schemas/pokemon/schema.ts.

graphql
union Battle = BattleRoyale | BattleTrainer | BattleWild

type BattleRoyale {
  combatants: [CombatantMultiPokemon!]
  date: Float
  id: ID
  winner: Trainer
}

type BattleTrainer {
  combatant1: CombatantSinglePokemon
  combatant2: CombatantSinglePokemon
  date: Float
  id: ID
  winner: Trainer
}

type BattleWild {
  date: Float
  id: ID
  pokemon: Pokemon
  result: BattleWildResult
  trainer: Trainer
  wildPokemons: [Pokemon!]
}

enum BattleWildResult {
  pokemonsCaptured
  pokemonsDefeated
  trainerDefeated
}

interface Being {
  id: ID
  name: String
}

type CombatantMultiPokemon {
  pokemons: [Pokemon!]
  trainer: Trainer
}

type CombatantSinglePokemon {
  pokemon: Pokemon
  trainer: Trainer
}

"""
A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.This scalar is serialized to a string in ISO 8601 format and parsed from a string in ISO 8601 format.
"""
scalar Date

input DateFilter {
  gte: Date
  lte: Date
}

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

type Patron implements Being {
  id: ID
  money: Int
  name: String
}

type Pokemon implements Being {
  attack: Int!
  birthday: Date!
  defense: Int!
  hp: Int!
  id: ID!
  name: String!
  trainer: Trainer
  type: PokemonType!
}

input PokemonFilter {
  birthday: DateFilter
  name: StringFilter
  type: PokemonType
}

enum PokemonType {
  bug
  electric
  fire
  grass
  water
}

type Query {
  battles: [Battle!]!
  beings: [Being!]!
  pokemonByName(name: String!): [Pokemon!]
  pokemons(filter: PokemonFilter): [Pokemon!]
  trainerByName(name: String!): Trainer
  trainers: [Trainer!]
}

input StringFilter {
  contains: String
  in: [String!]
}

type Trainer implements Being {
  class: TrainerClass
  fans: [Patron!]
  id: ID
  name: String
  pokemon: [Pokemon!]
}

enum TrainerClass {
  bugCatcher
  camper
  picnicker
  psychic
  psychicMedium
  psychicYoungster
  sailor
  superNerd
  tamer
  teamRocketGrunt
  triathlete
  youngster
  youth
}

Released under the MIT License.