Enum default_value serialization issue
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
Inizia riproducendo gli esempi di default_value dell'argomento enum e tracciando come vengono serializzati i valori predefiniti durante l'introspezione dello schema. Confronta il risultato con il comportamento di graphql-js; il lavoro è completato quando un valore predefinito enum viene emesso come il suo nome, senza virgolette di stringa con escape, e può essere utilizzato da graphql-tools per lo schema stitching.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Originally reported in graphene issue #691
Argument default_value serializes enum value instead of name. graphql spec does not support enum values and graphql-js serializes enums to the name not value. graphql-python is not consistent with graphql-js. I attempted to find a workaround by setting the enum value to a string of the name but teh result is a string that includes escaped quotes.
Using the name of the enum doesn't work:
class MyEnum(graphene.Enum):
FOO=0
BAR=1
foobar = graphene.List(FooBar, my_enum=graphene.Argument(MyEnum, default_value=MyEnum.FOO.name))
This results in the defaultValue being "\"FOO\"". This does not follow the graphql spec for enums and breaks with third party introspection. Specifically i'm trying to stitch a graphene remote schema and the invalid defaultValue results in a null returned in the merged schema (using graphql-tools).
Using a string value doesn't work either:
class MyEnum(graphene.Enum):
FOO="FOO"
BAR="BAR"
This also doesn't work with using MyEnum.FOO.value for default_value nor setting it specifically to the static string "FOO".
I tried looking for how default_value gets resolved for enums but haven't been able to track it down. I think if we can just get the string value for default_value to not include the escaped string quotes then my schema stitching will work. I haven't been able to figure out how to define an enum so that this will happen.
- Lingua principale
- Python
- Stelle
- 371
- Fork
- 175
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di graphql-python/graphql-core-legacy
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Quiver source Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
graphql-python/graphql-core-legacy#286 · 3 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
graphql-python/graphql-core-legacy#280 · 2 commenti · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Tutte le issue di graphql-python/graphql-core-legacy
Issue simili
-
agent-ready documentation needs-triage
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
instance instance add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
searxng/searx-instances#939 · 1 commento ·
-
area-deployment area-integrations triage:bot-seen
Difficoltà 2/5 Mezza giornata Idoneità per principianti 86/100