graphql-python / graphql-python/graphene

Is it possible to dynamically create InputObjectType objects ?

Aperta
#1,434 1 commento 0 reazioni 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

My problem: I have a method foo that takes an InputObjectType as input and does some logic, from those InputObjectType, I need to create, dynamically in the backend, other InputObjectType that will also be passed to the foo method.

When I try to create the InputObjectType, I get a type String is not json serializable error.
Is what am saying possible ? or should refactor my foo method to take dicts or something else ?

```python
def foo(input: SomeInputObjectType):
some_logic(input.some_attribute)

def mutate(..., input1):
# I want to create object input2 that can be passed to the foo method along with input1
# input2 = InputObjectType(...)
foo(input1)
foo(input2)
```

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.