Skip to content

Setting strawberry.unset as a default does not set the input arguments as optional ones. #3804

Closed
@akademy

Description

@akademy

Describe the Bug

With an input to a mutation like the following, neither of the inputs are optional, you must specify both:

@strawberry.input
class UserUpdateInput: 
    name: str = strawberry.UNSET 
    description: str = strawberry.UNSET

We get an error like ""Field 'UpdateInput.name' of required type 'String!' was not provided."

If I set them to any other default value then they do become optional, as expected.

System Information

  • Strawberry version (if applicable): strawberry-graphql[fastapi]==0.262.1

Additional Context

I am also trying to avoid setting the name to have a None value as this conflicts with my database setup (a non-nullable value)

Perhaps I am missunderstanding the way this should be working....

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginfo-neededNeeds more info from OP

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions