Created
December 3, 2015 16:21
-
-
Save OlegIlyenko/657a4fbc6608a3a4e2da to your computer and use it in GitHub Desktop.
An example of using standalone GraphQL input object parsing and formatting with Sangria
This file contains hidden or 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
import sangria.renderer.QueryRenderer | |
import sangria.macros._ | |
import sangria.ast | |
val parsed: ast.Value = | |
graphqlInput""" | |
{ | |
id: "1234345" | |
version: 2 # changed 2 times | |
deliveries: [ | |
{id: 11, received: false, note: null, state: OPEN} | |
# delivered a bit too late | |
{id: 45, received: true, note: "short delay", state: CLOSED} | |
] | |
} | |
""" | |
val rendered: String = | |
QueryRenderer.render(parsed, QueryRenderer.PrettyInput) | |
println(rendered) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment