mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-25 19:13:57 +03:00
Docs on changing the name of an ObjectType (#922)
Fixes https://github.com/graphql-python/graphene/issues/839
This commit is contained in:
parent
ca9188a615
commit
0805436d45
|
@ -230,4 +230,17 @@ previous example you could do:
|
||||||
peter.first_name # prints "Peter"
|
peter.first_name # prints "Peter"
|
||||||
peter.last_name # prints "Griffin"
|
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/
|
.. _Interface: /docs/interfaces/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user