Skip to content

Use query alias as GraphQL specification #1

@mariogarcia

Description

@mariogarcia

At the moment the alias is added as a method call at the end of the query:

import gql.DSL

def result = DSL.execute(schema) {
  query('byYear', [year: '1962']) {
    returns(Film) {
      title
      year
    }
    alias 'first'
  }

  query('byYear', [year: '2015']) {
    returns {
      title
      year
      bond
    }
    alias 'last'
  }
}

It would be great to use statement labels as query alias. Something like this:

import gql.DSL

def result = DSL.execute(schema) {
  first: query('byYear', [year: '1962']) {
    returns(Film) {
      title
      year
    }
  }

  last: query('byYear', [year: '2015']) {
    returns {
      title
      year
      bond
    }
  }
}

That I think should involve an AST transform.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions