graphql-python / graphql-python/graphene

Multiple choice Enum Arguments

Aperta
#1,329 1 commento 1 reazione 0 assegnatari Vedi su GitHub
✨ enhancement
Lingua principale
Python
Stelle
8.2k
Fork
818
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I would like to define an Argument that derives its value from an enum but can take multiple values
at the same time from the enum. so maybe like a list of enum values.

for example here is some choices that may be more than one choice at the same time and be valid in a search for ex.

```
class AgeRangeEnum(graphene.Enum):
TOD = 'TOD'
CHI = 'CHI'
PRE = 'PRE'
ADO = 'ADO'
ADU = 'ADU'
PWO = 'PWO'
SEN = 'SEN'

@property
def description(self):
if self == AgeRangeEnum.TOD:
return 'TODDLERS'
if self == AgeRangeEnum.CHI:
return 'CHILDREN'
if self == AgeRangeEnum.PRE:
return'PRETEENS'
if self == AgeRangeEnum.ADO:
return 'ADOLESCENTS'
if self == AgeRangeEnum.ADU:
return 'ADULTS'
if self == AgeRangeEnum.PWO:
return 'PREGNANTWOMEN'
if self == AgeRangeEnum.SEN:
return 'SENIORS'

....
# this is where I need help figuring out how it could take multiple values at the same time
# from the enum above.
age_range=graphene.Argument(AgeRangeEnum, required=False, default_value=''),

```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.