ariadne-codegen: Unexpected
When trying to generate a package using the following pyproject.toml file:
[tool.ariadne-codegen]
remote_schema_url = "https://rippleenergy.com/graphql"
queries_path = "src/ripple_energy/graphql/"
I get the following error:
Traceback (most recent call last):
File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\Scripts\ariadne-codegen.exe\__main__.py", line 7, in <module>
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\ariadne_codegen\main.py", line 33, in main
client(config_dict)
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\ariadne_codegen\main.py", line 61, in client
definitions = get_graphql_queries(settings.queries_path)
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\ariadne_codegen\schema.py", line 38, in get_graphql_queries
queries_ast = parse(queries_str)
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\graphql\language\parser.py", line 113, in parse
return parser.parse_document()
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\graphql\language\parser.py", line 241, in parse_document
definitions=self.many(TokenKind.SOF, self.parse_definition, TokenKind.EOF),
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\graphql\language\parser.py", line 1149, in many
nodes = [parse_fn()]
File "C:\Users\danie\AppData\Local\hatch\env\virtual\ripple-energy\jAAfYL9X\ripple-energy\lib\site-packages\graphql\language\parser.py", line 302, in parse_definition
raise self.unexpected(keyword_token)
graphql.error.syntax_error.GraphQLSyntaxError: Syntax Error: Unexpected <EOF>.
GraphQL request:1:1
1 |
| ^
Where am I going wrong? Or is this a bug?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 19 (10 by maintainers)
Replace GraphQL with PostgreSQL. There’s schema, but how can you get from it what database queries an app is going to execute? Codegen is not an ORM, just GraphQL queries to Python methods converter.
Please look at test project our suite uses. It has config file which points to schema.graphql and queries.graphql and codegen outputs
expected_client.It’s in first paragraph 😉
Ariadne Codegen is not an ORM or query builder for GraphQL. You need to point it at GraphQL schema and write the GraphQL queries yourself. We only convert them to Python code for you.
If you need an example of usage, there’s EXAMPLE.md file which shows simple client generation setup.