diff --git a/src/graphql/utilities/build_client_schema.py b/src/graphql/utilities/build_client_schema.py index 4d4addd4..cdfd5a00 100644 --- a/src/graphql/utilities/build_client_schema.py +++ b/src/graphql/utilities/build_client_schema.py @@ -175,6 +175,7 @@ def build_enum_def(enum_introspection: Dict) -> GraphQLEnumType: description=enum_introspection.get("description"), values={ value_introspect["name"]: GraphQLEnumValue( + value=value_introspect["name"], description=value_introspect.get("description"), deprecation_reason=value_introspect.get("deprecationReason"), ) diff --git a/tests/utilities/test_build_client_schema.py b/tests/utilities/test_build_client_schema.py index 48636f1a..0726a52b 100644 --- a/tests/utilities/test_build_client_schema.py +++ b/tests/utilities/test_build_client_schema.py @@ -382,28 +382,29 @@ def builds_a_schema_with_an_enum(): # It's also an Enum type on the client. client_food_enum = assert_enum_type(client_schema.get_type("Food")) - # Client types do not get server-only values, so they are set to None - # rather than using the integers defined in the "server" schema. + # Client types do not get server-only values, so they are set to the + # names of the enum values rather than using the integers defined in + # the "server" schema. values = { name: value.to_kwargs() for name, value in client_food_enum.values.items() } assert values == { "VEGETABLES": { - "value": None, + "value": "VEGETABLES", "description": "Foods that are vegetables.", "deprecation_reason": None, "extensions": None, "ast_node": None, }, "FRUITS": { - "value": None, + "value": "FRUITS", "description": None, "deprecation_reason": None, "extensions": None, "ast_node": None, }, "OILS": { - "value": None, + "value": "OILS", "description": None, "deprecation_reason": "Too fatty.", "extensions": None,