Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to dynamically create InputObjectType objects ? #1434

Open
deadly-panda opened this issue Jul 1, 2022 · 1 comment
Open

Comments

@deadly-panda
Copy link

deadly-panda commented Jul 1, 2022

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 ?

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)
@erikwrede
Copy link
Member

Hey there, can you please provide a MWE to reproduce the error? Usually, you should be able to use your input types just like any other input fields in mutations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants