Graphqlbundle: Argument 1 passed to Overblog\\GraphQLBundle\\Definition\\Argument::__construct() must be of the type array or null, object given

Created on 5 Jul 2018  路  4Comments  路  Source: overblog/GraphQLBundle

| Q | A
| ---------------- | -----
| Bug report? | yes
| Feature request? | no
| BC Break report? | no
| RFC? | no
| Version/Branch | 0.11.1

I am declaring my schema in yaml like so:

Organization:
    type: object
    config:
        resolveField: '@=resolver("App\\GraphQL\\Resolver\\OrganizationResolver", [value, args, context, info])'
        fields:
            # ... more fields
            route:
                type: "Route!"
                access: "@=hasPermission(value, 'route_view')"
                args:
                    id:
                        type: "ID!"

The Organization has a resolveField
The route field has an access rule.

If I then make the following request:

query  {
  organization(id: 1) {
    route(id: "xxui") {
      id
    }
  }
}

I get the following error:

Argument 1 passed to Overblog\\GraphQLBundle\\Definition\\Argument::__construct() must be of the type array or null, object given, called in /var/www/projects/strollplanner-flex/vendor/overblog/graphql-bundle/Resolver/Resolver.php on line 53

But if I use the following configuration:

Organization:
    type: object
    config:
        resolveField: '@=resolver("App\\GraphQL\\Resolver\\OrganizationResolver", [value, args, context, info])'
        fields:
            # ... more fields
            route:
                type: "Route!"
                ### \/ This has been added ###
                resolve: '@=resolver("App\\GraphQL\\Resolver\\OrganizationResolver", [value, args, context, info])'
                access: "@=hasPermission(value, 'route_view')"
                args:
                    id:
                        type: "ID!"

It works perfectly fine.

If I remove the access rule in the first example it works perfectly fine as well.

bug

All 4 comments

Can you also please provide the version of webonyx graphql-php with a composer info?

webonyx/graphql-php: v0.12.2

Ok thanks, the bug come from the combinaison of access and resolveField. I'll fix this by next week.

Fixed in v0.11.2. Thank you again!

Was this page helpful?
0 / 5 - 0 ratings