S
S
sanan :o2019-03-28 18:36:36
symfony
sanan :o, 2019-03-28 18:36:36

How to configure GraphQLBundle to pass an array of objects to input args?

I have these configs:

Mutation:
    type: object
    config:
        fields:
            CreateUserReportConfiguration:
                type: CreateUserReportConfigurationPayload!
                resolve: "@=mutation('create_user_report_configuration', [args['input']])"
                args:
                    input:
                        type: CreateUserReportConfigurationInput!

CreateUserReportConfigurationPayload:
    type: object
    config:
        fields:
            id:
                type: "Int"
            user_id:
                type: "Int"
            fields:
                type: "[ColumnReport]"
CreateUserReportConfigurationInput:
    type: input-object
    config:
        fields:
            user_id:
                type: "Int!"
            fields:
                type: "[ColumnReport]!"

in CreateUserReportConfigurationInput.config.fields.fields.type as a parameter, you can see how I want to pass an array of objects, described in the corresponding file:
ColumnReport:
    type: object
    config:
        fields:
            column_name:
                type: "String"
            table_name:
                type: "String"

But at the moment, the bundle returns a 500 error with the text
The type of CreateUserReportConfigurationInput.fieldList must be Input Type but got: [ColumnReport]!. That is, it tells me that I cannot send an array of objects to the server via graphql, which, in my opinion, is some kind of nonsense. How to deal with this problem? I need to send an array of ColumnReport objects in this fields field.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question