torchbox / wagtail-grapple

A Wagtail app that makes building GraphQL endpoints a breeze!
https://wagtail-grapple.readthedocs.io/en/latest/
Other
151 stars 57 forks source link

Creating a DjangoObjectType without either the `fields` or the `exclude` option is deprecated #355

Open stephencockerill opened 10 months ago

stephencockerill commented 10 months ago

Upgrading to wagtail 5.1 and graphene 3.3 results in the following deprecation warnings for all models registered with wagtail-grapple:

/home/wagtail/.local/lib/python3.9/site-packages/graphene/utils/subclass_with_meta.py:46: DeprecationWarning: Creating a DjangoObjectType without either the fields or the exclude option is deprecated. Add an explicit fields = '__all__' option on DjangoObjectType StubBlogPost to use all fields

The issue appears to be coming from grapple.actions.build_node_type:

    class StubMeta:
        model = stub_model

Based on the warning, there should be a fields = '__all__' attribute included.

patillacode commented 7 months ago

I think the issue is fixed on the graphene side rather than here.

https://github.com/graphql-python/graphene/pull/1530