GraphQL 引数のあるquery
こんなスキーマがあったとしよう↓
code:schema.graphql
type Query {
text(argument: String): Text
}
type Text {
hello: String!
argument: String
}
helloはHello World!だけを返すStringで、
argumentは引数argumentをそのまま返す仕様になっている
引数を付けたクエリはこんな感じ
code:query.graphql
query {
text(argument: "あいうえお") {
hello,
argument
}
}
これの結果↓
code:result.json
{
"data": {
"text": {
"hello": "Hello World!",
"argument": "あいうえお"
}
}
}