I am trying to fetch first five items of a set. My query is following:
query sequence($id: String) {
sequence(id: $id) {
items(first:1) {
content
}
}
}
How ever, I get response
"Unknown argument \"first\" on field \"items\" of type \"Sequence\"."
As far as I understood from the docs this is how I am supposed to make query if I want to get a limited amount of items back.
Do I need to define the argument somewhere in the schema? How do I limit the amount of returned items properly?
I am trying to fetch first five items of a set. My query is following:
query sequence($id: String) {
sequence(id: $id) {
items(first:1) {
content
}
}
}
How ever, I get response
"Unknown argument \"first\" on field \"items\" of type \"Sequence\"."
As far as I understood from the docs this is how I am supposed to make query if I want to get a limited amount of items back.
Do I need to define the argument somewhere in the schema? How do I limit the amount of returned items properly?
Share Improve this question asked Apr 19, 2018 at 9:33 Jaakko KarhuJaakko Karhu 2,3864 gold badges29 silver badges42 bronze badges1 Answer
Reset to default 7All field arguments need to be defined in the schema, the default behaviour is for a field to accept no arguments.
You can define a first
argument in your items
field in your schema using syntax like this:
type Sequence {
items(first: Int): [Item]
}
(See: Example No. 120 in the spec.)