-
-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for native enum docstring
- Loading branch information
1 parent
d504428
commit 44ded9e
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Release type: patch | ||
|
||
Use native enum `__doc__` as the description for the schema enum type. | ||
|
||
```py | ||
# somewhere.py | ||
from enum import Enum | ||
|
||
|
||
class AnimalKind(Enum): | ||
"""The kind of animal.""" | ||
|
||
AXOLOTL, CAPYBARA = range(2) | ||
``` | ||
|
||
This will generate the following schema: | ||
|
||
```graphql | ||
"""The kind of animal.""" | ||
enum AnimalKind { | ||
AXOLOTL | ||
CAPYBARA | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters