graphql-python / graphql-python/graphene

Is it possible to dynamically create InputObjectType objects ?

Abierto
#1,434 1 comentario 0 reacciones 0 asignados Ver en GitHub
✨ enhancement
Lenguaje dominante
Python
Estrellas
8.2k
Forks
818
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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)
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start with Graphene's InputObjectType behavior and the foo and mutate entry points shown in the issue. Reproduce the String is not JSON serializable error with the proposed dynamically created input, then determine whether construction is supported or whether the foo boundary needs to accept another representation. Done means the supported approach or required refactor is documented and verified.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api, backend-api-design
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.