Skip to content

Cannot use Alias with custom binding #169

@james-ff

Description

@james-ff

Hello,

I'm using graphql-binding on top of postgraphile to build custom backend functions for my graphql api. I often shorten some of the long auto-generated names for relationship fields for ease of use on the frontend. This works fine with postgraphile on its own, but when called through a binding it errors when an Alias is used to rename one of the fields. I've tested a number of times and it is indeed caused by the use of an Alias. Bindings works fantastically for my use case, but not being able to use Aliases is a bit of a hindrance.

Binding use example (this is exposed in my api under the query field name "test")

binding.query.allCustomers({}, info, { context })

This is ok:

query {
  test {
    nodes {
      firstName
    }
  }
}

This errors only with bindings:

query {
  test {
    nodes {
      name: firstName
    }
  }
}

Can anyone shed some light on this issue? And confirm / deny if this affects all use cases of bindings or is specific to my use?

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions