I'm running an Absinthe query, with three argument fields, all of them lists of integers.
@desc "Fetches resolutions of Taiga ids"
field :taiga_ids, :taiga_entities do
arg :usIds, list_of(:integer)
arg :taskIds, list_of(:integer)
arg :issueIds, list_of(:integer)
resolve &Resolvers.Bridges.fetch_taiga_ids/3
end
object :taiga_entities do
field :uss, list_of(:taiga_us)
field :tasks, list_of(:taiga_task)
field :issues, list_of(:taiga_issue)
end
I'm also using Insomnia to send queries and play with the results. As far as I know, everything is correctly written, the types are respected and arguments are correctly typed.
{
taigaIds(usIds: [1914], taskIds: [], issueIds: [7489]) {
uss {
id
ref
subject
}
issues {
id
ref
subject
}
}
}
But I get the following errors, which make no sense.
{
"errors": [
{
"message": "Unknown argument \"usIds\" on field \"taigaIds\" of type \"RootQueryType\".",
"locations": [
{
"line": 2,
"column": 0
}
]
},
{
"message": "Unknown argument \"taskIds\" on field \"taigaIds\" of type \"RootQueryType\".",
"locations": [
{
"line": 2,
"column": 0
}
]
},
{
"message": "Unknown argument \"issueIds\" on field \"taigaIds\" of type \"RootQueryType\".",
"locations": [
{
"line": 2,
"column": 0
}
]
}
]
}
Any ideas why?
By convention, names of schema entities like fields and arguments are written camelCase
, while elixer uses snake_case
. absinthe
converts between these two naming conventions. According to the docs:
This defines an adapter that supports GraphQL query documents in their conventional (in JS) camelcase notation, while allowing the schema to be defined using conventional (in Elixir) underscore (snakecase) notation, and tranforming the names as needed for lookups, results, and error messages
...
Note variables are a client-facing concern (they may be provided as parameters), so variable names should match the convention of the query document (eg, camelCase).
In other words, define your args like this:
arg :task_ids, list_of(:integer)
and they will be converted to camelCase
for you.