Patrick Arminio

Results 669 comments of Patrick Arminio

Related: https://github.com/graphql-python/graphene/pull/1153 We could also have enums like this: ``` Ordinal = strawberry.enum('NORTH', 'SOUTH') Ordinal.SOUTH ``` so they are more inline with GraphQL :)

Good idea! I’m not sure about the name, maybe it is better to have `strawberry.enum.value`, but not 100% sure. I feel like enums in GraphQL are more like Unions and...

> Is there any way to work around this at the moment? > > We're looking to use the enum values for some enums. going to make a new release...

> This issue been added to the v1 milestones, but what I'm having trouble parsing the following from the discussion: > > * What was the conclusion on using the...

> As far as controlling whether to use the Enum name vs value, can we make that an option on the schema instead of per-Enum? Similar to the configuration for...

so we could this: ```python class Config(StrawberryConfig): enums_from_values = True strawberry.Schema(Query, config=Config()) ``` --- Reminder: if we use the values as names we should do validation, I've seen enums where...

Literal is nice, and supports annotated, if we'd need to add additional information ``` from typing import Literal, Annotated def something(v: str) -> None: return None MODE = Literal['r', 'rb',...

thought we still need to do this: ``` Mode = strawberry.enum(name="Mode", type=Literal['r', 'rb', 'w', Annotated['wb', something('abc')]]) ``` which has the same as issue mentioned before

@AndrewIngram you'd still need to pass name, as we'd need it at runtime. And yes, we can make a plugin for mypy, but reusing Literal might be easier 😊

@omarzouk would you be able to add a test case for this? 😊