-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix codegen rejecting operations that contained inline fragments with…
… type conditions on interfaces because it was only checking possibleTypes, which cannot contain interfaces
- Loading branch information
Showing
4 changed files
with
1,247 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
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,29 @@ | ||
import os | ||
from io import StringIO | ||
from graphql import Source | ||
|
||
from sgqlc.codegen.operation import CodeGen, load_schema, ParsedSchemaName | ||
|
||
|
||
def test_operation_gen_nested_interface(): | ||
result_buff = StringIO() | ||
test_schema_path = os.path.join( | ||
'tests', 'test-resources', 'operation-codegen', 'operation-test.json' | ||
) | ||
test_op_path = os.path.join( | ||
'tests', 'test-resources', 'operation-codegen', 'op-gen.gql' | ||
) | ||
schema_name = ParsedSchemaName.parse_schema_name('.schema') | ||
|
||
with open(test_op_path) as op_file, open(test_schema_path) as schema_file: | ||
operation_gql = [Source(op_file.read(), op_file.name)] | ||
schema = load_schema(schema_file) | ||
gen = CodeGen( | ||
schema, | ||
schema_name, | ||
operation_gql, | ||
result_buff.write, | ||
short_names=False, | ||
) | ||
gen.write() | ||
result_buff.close() |
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,7 @@ | ||
query QueryFieldOnNestedInterface { | ||
foo { | ||
... on Bar { | ||
barField | ||
} | ||
} | ||
} |
Oops, something went wrong.