blb-ventures / strawberry-django-plus

Enhanced Strawberry GraphQL integration with Django
MIT License
179 stars 47 forks source link

relay: compatibility with the new strawberry.relay module #230

Closed devkral closed 1 year ago

devkral commented 1 year ago

It seems that the _id_attr field is not removed from the field set

strawberry.exceptions.unresolved_field_type.UnresolvedFieldTypeError: Could not resolve the type of '_id_attr'. Check that the class is accessible from the global module scope.

  File "/.venv/lib/python3.11/site-packages/strawberry/schema/schema.py", line 158, in __init__
    raise error.__cause__ from None
  File ".venv/lib/python3.11/site-packages/graphql/type/definition.py", line 808, in fields
    fields = resolve_thunk(self._fields)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/graphql/type/definition.py", line 300, in resolve_thunk
    return thunk() if callable(thunk) else thunk
           ^^^^^^^
  File ".venv/lib/python3.11/site-packages/strawberry/schema/schema_converter.py", line 438, in <lambda>
    fields=lambda: self.get_graphql_fields(object_type),
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/strawberry/schema/schema_converter.py", line 327, in get_graphql_fields
    return self._get_thunk_mapping(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/strawberry/schema/schema_converter.py", line 317, in _get_thunk_mapping
    raise UnresolvedFieldTypeError(type_definition, field)
devkral commented 1 year ago

this is a problem in strawberry-graphql-django. They extract all annotated fields instead of using the strawberry logic (dataclass logic)

classvars are not excluded this way

bellini666 commented 1 year ago

Hey @devkral ,

I'm currently porting strawberry-django-plus to the new relay structure. After that I'll fix strawberry-graphql-django as well :)