Trying to assign a lazy type annotation using a relative path outside of a strawberry class will result in a type error. This doesn't happen when using an absolute path.
LazyFoo = Annotated[
"Foo", strawberry.lazy("..foo.schema")
]
@strawberry.type
class Bar:
foo: LazyFoo
results in:
app-1 | File "/usr/local/lib/python3.9/site-packages/graphql/type/schema.py", line 432, in collect_referenced_types
app-1 | for field in named_type.fields.values():
app-1 | File "/usr/local/lib/python3.9/functools.py", line 993, in __get__
app-1 | val = self.func(instance)
app-1 | File "/usr/local/lib/python3.9/site-packages/graphql/type/definition.py", line 811, in fields
app-1 | raise cls(f"{self.name} fields cannot be resolved. {error}") from error
app-1 | TypeError: FooNode fields cannot be resolved. attempted relative import beyond top-level package
==0.133.5
Discord thread: https://discord.com/channels/689806334337482765/1041969597982715904/1041969597982715904
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too