Skip to content

Commit

Permalink
Fix __typename for non-default modules.
Browse files Browse the repository at this point in the history
The `__typename` in non-default modules was getting mangled incorrectly.

Issue #5985 (a)
  • Loading branch information
vpetrovykh authored and msullivan committed Sep 27, 2023
1 parent 00854f4 commit 6d5d78a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion edb/graphql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ def get_field_template(
eql = parse_fragment(f'{self.gql_typename!r}')
else:
# Construct the GraphQL type name from the actual type name.
eql = parse_fragment(f'''
eql = parse_fragment(fr'''
WITH name := {codegen.generate_source(parent)}
.__type__.name
SELECT (
Expand Down
16 changes: 16 additions & 0 deletions tests/test_http_graphql_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -2561,6 +2561,22 @@ def test_graphql_functional_typename_03(self):
]
})

def test_graphql_functional_typename_04(self):
self.assert_graphql_query_result(r"""
query {
other__Foo(order: {color: {dir: ASC}}) {
__typename
color
}
}
""", {
"other__Foo": [
{"__typename": "other__Foo_Type", "color": "RED"},
{"__typename": "other__Foo_Type", "color": "GREEN"},
{"__typename": "other__Foo_Type", "color": "BLUE"},
]
})

def test_graphql_functional_scalars_01(self):
self.assert_graphql_query_result(r"""
query {
Expand Down

0 comments on commit 6d5d78a

Please sign in to comment.