Skip to content

Required DjangoFilterConnectionField has "no _meta attribute" error. #700

Closed
@jckw

Description

@jckw

Since [issue], it's been possible to make DjangoFilterConnectionFields and ConnectionFields non-nullable using the required=True kwarg. E.g.

    filtered_properties = DjangoFilterConnectionField(
        PropertyType, required=True
    )

However, querying this field fails due to the error below.

'NonNull' object has no attribute '_meta'
  File "/usr/local/lib/python3.6/site-packages/promise/promise.py", line 403, in _resolve_from_executor
    executor(resolve, reject)
  File "/usr/local/lib/python3.6/site-packages/promise/promise.py", line 655, in executor
    return resolve(f(*args, **kwargs))
  File "/usr/local/lib/python3.6/site-packages/graphql/execution/middleware.py", line 76, in make_it_promise
    return next(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/graphene_django/filter/fields.py", line 106, in connection_resolver
    **args
  File "/usr/local/lib/python3.6/site-packages/graphene_django/fields.py", line 157, in connection_resolver
    queryset = cls.resolve_queryset(connection, default_manager, info, args)
  File "/usr/local/lib/python3.6/site-packages/graphene_django/fields.py", line 87, in resolve_queryset
    return connection._meta.node.get_queryset(queryset, info)
[07/Jul/2019 09:28:43] "POST /graphql HTTP/1.1" 200 172

This is possibly due to the NonNull structure's of_type not being used, yet a normal relay.ConnectionField seems to work fine with a required=True kwarg.

Fixing this is particularly useful for users generating types from schemas (like Apollo's codegen), especially since ConnectionFields are in fact non-nullable by default since the edges field is always returned.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions