Skip to content

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

Open
@YuriiMotov

Description

@YuriiMotov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions