diff --git a/v3-release-notes.md b/v3-release-notes.md index ac19602..7cbb246 100644 --- a/v3-release-notes.md +++ b/v3-release-notes.md @@ -88,7 +88,40 @@ TODO ### Enum inputs -TODO +As outlined above: if a field takes an Enum as an input the resolver will now get passed the Enum member rather than the member value. + +For example, given the following schema: + +```python +from graphene import Enum, ObjectType, String, Schema + +class Color(Enum): + RED = 1 + GREEN = 2 + BLUE = 3 + +class Query(ObjectType): + color = String(color_input=Color(required=True)) + + def resolve_color(root, info, color_input): + return color_input + +schema = Schema(query=Query) +``` + +Before: + +```python +result = schema.execute("query { color(colorInput: RED) }") +assert result.data["color"] == "1" +``` + +After: + +```python +result = schema.execute("query { color(colorInput: RED) }") +assert result.data["color"] == "EnumMeta.RED" +``` ---