From 0805436d45736b552ba5e41967cf070f4f289e35 Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Sat, 16 Mar 2019 21:58:49 +0000 Subject: [PATCH] Docs on changing the name of an ObjectType (#922) Fixes https://github.com/graphql-python/graphene/issues/839 --- docs/types/objecttypes.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/types/objecttypes.rst b/docs/types/objecttypes.rst index b6eb3087..c15d608b 100644 --- a/docs/types/objecttypes.rst +++ b/docs/types/objecttypes.rst @@ -230,4 +230,17 @@ previous example you could do: peter.first_name # prints "Peter" peter.last_name # prints "Griffin" +Changing the name +----------------- + +By default the type name in the GraphQL schema will the same as the class name +that defines the ``ObjectType``. This can be changed by setting the ``name`` +property on the ``Meta`` class: + +.. code:: python + + class MyGraphQlSong(graphene.ObjectType): + class Meta: + name = 'Song' + .. _Interface: /docs/interfaces/