Skip to content

Commit 71d5b1d

Browse files
authored
Merge pull request #587 from ekampf/feature/enum_docs_update
Improved docs for Enums
2 parents 3fe12ca + 7f59a8f commit 71d5b1d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

docs/types/enums.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ the ``Enum.from_enum`` function.
5454
5555
graphene.Enum.from_enum(AlreadyExistingPyEnum)
5656
57+
``Enum.from_enum`` supports a ``description`` and ``deprecation_reason`` lambdas as input so
58+
you can add description etc. to your enum without changing the original:
59+
60+
.. code:: python
61+
62+
graphene.Enum.from_enum(AlreadyExistingPyEnum, description=lambda value: return 'foo' if value == AlreadyExistingPyEnum.Foo else 'bar')
63+
5764
5865
Notes
5966
-----
@@ -65,7 +72,7 @@ member getters.
6572
In the Python ``Enum`` implementation you can access a member by initing the Enum.
6673

6774
.. code:: python
68-
75+
6976
from enum import Enum
7077
class Color(Enum):
7178
RED = 1
@@ -78,7 +85,7 @@ In the Python ``Enum`` implementation you can access a member by initing the Enu
7885
However, in Graphene ``Enum`` you need to call get to have the same effect:
7986

8087
.. code:: python
81-
88+
8289
from graphene import Enum
8390
class Color(Enum):
8491
RED = 1

0 commit comments

Comments
 (0)