5

I would like to create a parameter object on the client side, so I dont need too many parameters.

I want to do something like this:

input Options {
    option1: String
    option2: String
}

query test($param: Options) {
    test(option1: $param.option1, option2: $param.option2) {
        id
    }
}

$param.option1 is not supported. Is there any way to access attributes of an object parameter?

1 Answer 1

6

You cannot create additional types on the client side. Additionally, there is currently no way to access individual properties on a variable, even when that variable is an input object type.

The only way to solve this issue is to update the test field on the server side to accept a single argument that's an input object type, instead of having multiple arguments.

type Query {
  test(options: OptionsInput): SomeType
}

input OptionsInput {
  option1: String
  option2: String
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much! I was afraid of this answer :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.