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

[cli]: object has no attribute 'operation_types' #8

Open
iwconfig opened this issue Oct 7, 2022 · 0 comments
Open

[cli]: object has no attribute 'operation_types' #8

iwconfig opened this issue Oct 7, 2022 · 0 comments

Comments

@iwconfig
Copy link

iwconfig commented Oct 7, 2022

The following error occur when using the CLI to generate definitions.

In [54]: from graphql_dsl.parser import parse

In [55]: parse(Path('sdl.gql').read_text())
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In [55], line 1
----> 1 parse(Path('sdl.gql').read_text())

File /opt/venv/lib/python3.10/site-packages/graphql_dsl/parser/__init__.py:6, in parse(src)
      4 def parse(src: str) -> graphql.DocumentNode:
      5     schema = graphql.parse(src)
----> 6     schema.definitions[0].operation_types[0].type.name.value
      7     return schema

AttributeError: 'InputObjectTypeDefinitionNode' object has no attribute 'operation_types'

another example using the sdl of https://countries.trevorblades.com/graphql

In [56]: parse(Path('sdl-trevorblades.gql').read_text())
...
AttributeError: 'DirectiveDefinitionNode' object has no attribute 'operation_types'

Python version 3.10

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

1 participant