strawberry-graphql / strawberry

A GraphQL library for Python that leverages type annotations 🍓
https://strawberry.rocks
MIT License
3.92k stars 516 forks source link

Documentation of `Annotated[MyEnum, strawberry.enum(MyEnum)]` #3563

Open zvyn opened 1 month ago

zvyn commented 1 month ago

More or less by accident I figured that this works, which is great:

FruitName = Annotated[other_module.FruitName, strawberry.enum(other_module.FruitName)]

Is this undocumented on purpose or should I add this to the Enum page in the docs? (I assume this doesn't work by accident)

patrick91 commented 1 month ago

I don't think it is supposed to work that way, I'd say the Annotated API should be:

FruitName = Annotated[other_module.FruitName, strawberry.enum(name="Fruit")]