Skip to content

Instantly share code, notes, and snippets.

@lbialy
Last active December 30, 2023 13:04
Show Gist options
  • Save lbialy/c9aa46136f3ee7897600c697de273567 to your computer and use it in GitHub Desktop.
Save lbialy/c9aa46136f3ee7897600c697de273567 to your computer and use it in GitHub Desktop.
Run with `scala-cli run caliban-demo.sc` or `scala-cli run https://gist.github.com/lbialy/c9aa46136f3ee7897600c697de273567`
//> using dep com.github.ghostdogpr::caliban-quick:2.5.0
enum Origin {
case EARTH, MARS, BELT
}
case class Character(
name: String,
nicknames: List[String],
origin: Origin
)
case class CharactersArgs(origin: Option[Origin])
case class CharacterArgs(name: String)
case class Query(
characters: CharactersArgs => List[Character],
character: CharacterArgs => Option[Character]
)
import caliban.*
import caliban.schema.ArgBuilder.auto.*
import caliban.schema.Schema.auto.*
println(render[Query])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment