Closed mnieber closed 3 years ago
@mnieber Nice find! I believe this is not unique to PydanticObjectType
but actually a feature of the base graphene.ObjectType
(that would explain why it works with django_graphene
too) -- see https://docs.graphene-python.org/en/stable/api/#object-types .Where would you suggest we should call this out specifically? I agree it's not very obvious from the base class documentation.
I created a PR: https://github.com/graphql-python/graphene-pydantic/pull/51. Let me know if you prefer something slightly different (or if you wish, you can change the PR)
Closed by #51
I was delighted that the following works (I copied something from django_graphene code), but AFAICT it's not a documented feature
I suppose you can add any additional field to a
PydanticObjectType
by declaring it and adding a resolve function for it? It would be nice to add this to the docs.