Fork me on GitHub
#graphql
<
2020-10-27
>
orestis09:10:59

Has anyone encountered an issue with Lacinia where query variables which are lists fail to parse?

orestis11:10:24

In particular, if there’s an InputObject that has a field which is a list, I cannot pass that value down as a query variable:

# this works
query WorkingQuery($search: [EDN_Filter]) {
  searchPosts(search: $search) {
    totalCount
    nodes {
      title
    }
  }
}
But this doesn’t:
mutation ChangeStatus($filters: [EDN_Filter], $status_id: ID!) {
  changeStatus(
    statusId: $status_id,
    postSelection: {
      filters: $filters
      selection: {without_ids: []}
    } ) {
    title
  }
}

Lennart Buit11:10:16

I have seen this before yeah, does it help to change the argument to be (whaver type is) a postSelection ? As an intermediate workaround ^^

orestis12:10:41

Yeah it’s what I do. I’m not sure if this is Lacinia related or part of the spec.

orestis11:10:32

I get this error:

{
  "errors": [
    {
      "message": "Exception applying arguments to field `changeStatus': For argument `postSelection', unknown argument `selection'.",
      "locations": [
        {
          "line": 48,
          "column": 3
        }
      ],
      "extensions": {
        "field": "__Mutations/changeStatus",
        "argument": "__Mutations/changeStatus.postSelection",
        "defined-arguments": null
      }
    }
  ]
}
(changed from the actual schema for terseness and clarity)

hlship16:10:58

I'm not sure variables inside input objects work.

hlship16:10:33

It's on my mental list of things to fix before a 1.0 release.

orestis18:10:12

Would it help if I open an issue?

orestis18:10:36

(It’s not a huge deal as there’s always a workaround)