Last active
December 30, 2023 13:04
-
-
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`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//> 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