Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this package support union type fragments? #30

Open
kevinmu opened this issue May 26, 2020 · 1 comment
Open

Does this package support union type fragments? #30

kevinmu opened this issue May 26, 2020 · 1 comment

Comments

@kevinmu
Copy link

kevinmu commented May 26, 2020

I have a .graphql file that looks like this:

query GetBook($id: UUID!) {
  book(id: $id) {
    author {
      id
      name
      ... on FantasyAuthor {
        fantasyBooksWritten
      }
      ... on SciFiAuthor {
        sciFiBooksWritten
      }
    }
  }
}

However, when I run gql run I get the following error:

Parsing /home/user/python-test/book_query.graphql ... Traceback (most recent call last):
  File "/home/user/.local/bin/gql", line 11, in <module>
    sys.exit(cli())
  File "/home/user/.local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/user/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/gql/cli.py", line 99, in run
    process_file(filename, query_parser, query_renderer)
  File "/home/user/.local/lib/python3.8/site-packages/gql/cli.py", line 68, in process_file
    parsed = parser.parse(query)
  File "/home/user/.local/lib/python3.8/site-packages/gql/query_parser.py", line 243, in parse
    visit(document_ast, TypeInfoVisitor(type_info, visitor))
  File "/home/user/.local/lib/python3.8/site-packages/graphql/language/visitor.py", line 286, in visit
    result = visit_fn(visitor, node, key, parent, path, ancestors)
  File "/home/user/.local/lib/python3.8/site-packages/graphql/language/visitor.py", line 394, in leave
    result = fn(self.visitor, node, *args) if fn else None
  File "/home/user/.local/lib/python3.8/site-packages/gql/query_parser.py", line 109, in leave_selection_set
    self.pull()
  File "/home/user/.local/lib/python3.8/site-packages/gql/query_parser.py", line 70, in pull
    return self.dfs_path.pop()
IndexError: pop from empty list

wondering if anyone has seen similar issues. Thanks!

@cmurphy208
Copy link

i have not used the library. but i read somewhere that you can only used named constructs. i.e. named query, named fragment etc. This is because the library wants to create a python class and needs a named construct to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants