Open weblab-misha opened 3 months ago
I've managed to run ariadne-codegen in VSCode python debugger, this is a screenshot from just before exception is raised:
Looks like "line" == "import_string" == 'from .enums import '
, so just_imports
variable is empty list
This is the same moment of execution, but I've switched to higher function in call stack:
And this is ast_to_str()
(the same moment of execution):
Here is the beginning of code
variable:
from typing import Optional, Any, Union, List, Annotated
from pydantic import Field, PlainSerializer
from .base_model import BaseModel
from .base_model import Upload
from .enums import
class ...
Looks like from .enums import
line causes the issue when passed to isort.code()
.
I tried to create a simple file test.py with a wrong from ... import
line:
from .enums import
class A:
pass
and run isort test.py
, but it works fine. Looks like isort
CLI handles these issues, so ariadne-codegen may be using isort.code()
in a wrong way (?)
Hi @weblab-misha, I know how to fix this issue, but I found it hard to recreate in my own schema. Could you provide a schema example so I can better understand where the issue lies?
ariadne-codegen --config ariadne-codegen.toml
runs fine unless I addinclude_all_inputs = false
in myariadne-codegen.toml
file. With include_all_inputs = false command fails with error:BTW, nothing is wrong with
include_all_enums = false
, it doesn't cause any issues.UPD: