You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like the strawberry documentation on accessing parent with function resolvers on this page tweaked to be more clear, or maybe corrected?
From what I understand in the docs, its suggesting you end up with the following. However, this doesn't even run? I have tried swapping the definitions both directions, they have the same issue. I had to resort to the self method on a method resolver, which seems less desirable to me since the docs specifically call out that it might not work quite right everywhere.
and it works like it should in Python, but there might be cases where it doesn’t properly follow Python’s semantics
Traceback (most recent call last):
File "/Users/.../Library/Application Support/JetBrains/IntelliJIdea2024.1/plugins/python/helpers/pydev/pydevd.py", line 1535, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/.../Library/Application Support/JetBrains/IntelliJIdea2024.1/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/.../src/api/python-graphql-poc/src/main.py", line 21, in <module>
def get_full_name(parent: strawberry.Parent[User2]) -> str:
^^^^^
NameError: name 'User2' is not defined
Perhaps there's a quirk in here where the structure of my file is part of the problem since everything is top level? I am using FastAPI, uvicorn and strawberry.
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered:
patrick91
changed the title
Review/Revise & Maybe Correct Strawberry Docs On Parent Resolvingstrawberry.Parent not supporting forward refs
May 2, 2024
I would like the strawberry documentation on accessing parent with function resolvers on this page tweaked to be more clear, or maybe corrected?
From what I understand in the docs, its suggesting you end up with the following. However, this doesn't even run? I have tried swapping the definitions both directions, they have the same issue. I had to resort to the
self
method on a method resolver, which seems less desirable to me since the docs specifically call out that it might not work quite right everywhere.Perhaps there's a quirk in here where the structure of my file is part of the problem since everything is top level? I am using FastAPI, uvicorn and strawberry.
Upvote & Fund
The text was updated successfully, but these errors were encountered: