Skip to content

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

@raphaelvigee

Description

@raphaelvigee
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions