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

Example code doesn't work (Operations -> Testing) #508

Open
YuriiMotov opened this issue Jul 10, 2024 · 0 comments
Open

Example code doesn't work (Operations -> Testing) #508

YuriiMotov opened this issue Jul 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@YuriiMotov
Copy link

YuriiMotov commented Jul 10, 2024

Describe the Bug

I'm trying to follow the documentation, but when I run the code from Testing section I get the error GraphQLError("Unknown argument 'title' on field 'Query.books'.", ....

It's said that we should use the schema from the Getting Started tutorial. The code is:

import typing
import strawberry

@strawberry.type
class Book:
    title: str
    author: str

def get_books():
    return [
        Book(
            title="The Great Gatsby",
            author="F. Scott Fitzgerald",
        ),
    ]

@strawberry.type
class Query:
    books: typing.List[Book] = strawberry.field(resolver=get_books)

schema = strawberry.Schema(query=Query)

I think we have to either add title parameter to get_books or remove title parameter from TestQuery.

Ready to send a PR if it's needed

System Information

  • Operating system: Ubuntu
  • Strawberry version (if applicable): latest

Additional Context

@YuriiMotov YuriiMotov added the bug Something isn't working label Jul 10, 2024
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

1 participant