graphql

orestis 2020-10-27T09:12:59.047300Z

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

orestis 2020-10-27T11:16:24.049100Z

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
  }
}

orestis 2020-10-27T11:17:32.050100Z

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)

2020-10-27T11:21:16.050300Z

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

orestis 2020-10-27T12:00:41.051200Z

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

hlship 2020-10-27T16:38:58.051800Z

I'm not sure variables inside input objects work.

hlship 2020-10-27T16:39:33.052100Z

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

orestis 2020-10-27T18:56:12.052600Z

Would it help if I open an issue?

orestis 2020-10-27T18:56:36.053300Z

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