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

create_type Throws error of field not having a name #3421

Open
jakubikan opened this issue Mar 25, 2024 · 2 comments
Open

create_type Throws error of field not having a name #3421

jakubikan opened this issue Mar 25, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jakubikan
Copy link

jakubikan commented Mar 25, 2024

Describe the Bug

ValueError: Field doesn't have a name. Fields passed to create_type must define a name by passing the name argument to strawberry.field.

It seems like that there is an issue when using create_type and passing fields.

Looking at the code here it uses python_name

if field.python_name is None:

which seems to be hardcoded to None here

python_name=None,

System Information

  • Operating system: Mac
  • Strawberry version (if applicable): 0.221.1

Additional Context

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.
Fund with Polar
@jakubikan jakubikan added the bug Something isn't working label Mar 25, 2024
@patrick91
Copy link
Member

@jakubikan can you show us an example of the code that triggers this issue? 😊

@jakubikan
Copy link
Author

jakubikan commented Mar 25, 2024

It basically happens when you don't pass a resolver to field

 my_name = strawberry.field(name="myName")
 query = create_type(f"Query", [my_name])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants