@@ -1606,7 +1606,7 @@ func TestExecutionEngine_Execute(t *testing.T) {
16061606 expectedHost : "example.com" ,
16071607 expectedPath : "/" ,
16081608 expectedBody : "" ,
1609- sendResponseBody : `{"data":{"__internal__typename_placeholder":"Query"}} ` ,
1609+ sendResponseBody : `doesn't matter, no fetch will be done, as query typename resolved by engine ` ,
16101610 sendStatusCode : 200 ,
16111611 }),
16121612 ),
@@ -1644,6 +1644,82 @@ func TestExecutionEngine_Execute(t *testing.T) {
16441644 expectedResponse : `{"data":{}}` ,
16451645 }))
16461646
1647+ t .Run ("execute operation with all nested fields skipped" , runWithoutError (ExecutionEngineTestCase {
1648+ schema : func (t * testing.T ) * graphql.Schema {
1649+ t .Helper ()
1650+ schema := `
1651+ type Query {
1652+ hero(name: String!): Hero!
1653+ }
1654+
1655+ type Hero {
1656+ name: String!
1657+ }
1658+ `
1659+ parseSchema , err := graphql .NewSchemaFromString (schema )
1660+ require .NoError (t , err )
1661+ return parseSchema
1662+ }(t ),
1663+ operation : func (t * testing.T ) graphql.Request {
1664+ return graphql.Request {
1665+ OperationName : "MyHero" ,
1666+ Variables : []byte (`{"heroName": "Luke"}` ),
1667+ Query : `query MyHero($heroName: String!){
1668+ hero(name: $heroName) {
1669+ name @skip(if: true)
1670+ }
1671+ }` ,
1672+ }
1673+ },
1674+ dataSources : []plan.DataSource {
1675+ mustGraphqlDataSourceConfiguration (t ,
1676+ "id" ,
1677+ mustFactory (t ,
1678+ testNetHttpClient (t , roundTripperTestCase {
1679+ expectedHost : "example.com" ,
1680+ expectedPath : "/" ,
1681+ expectedBody : "" ,
1682+ sendResponseBody : `{"data":{"hero":{"__typename":"Hero"}}}` ,
1683+ sendStatusCode : 200 ,
1684+ }),
1685+ ),
1686+ & plan.DataSourceMetadata {
1687+ RootNodes : []plan.TypeField {
1688+ {TypeName : "Query" , FieldNames : []string {"hero" }},
1689+ },
1690+ ChildNodes : []plan.TypeField {
1691+ {TypeName : "Hero" , FieldNames : []string {"name" }},
1692+ },
1693+ },
1694+ mustConfiguration (t , graphql_datasource.ConfigurationInput {
1695+ Fetch : & graphql_datasource.FetchConfiguration {
1696+ URL : "https://example.com/" ,
1697+ Method : "POST" ,
1698+ },
1699+ SchemaConfiguration : mustSchemaConfig (
1700+ t ,
1701+ nil ,
1702+ `type Query { hero(name: String!): Hero! } type Hero { name: String! }` ,
1703+ ),
1704+ }),
1705+ ),
1706+ },
1707+ fields : []plan.FieldConfiguration {
1708+ {
1709+ TypeName : "Query" ,
1710+ FieldName : "hero" ,
1711+ Path : []string {"hero" },
1712+ Arguments : []plan.ArgumentConfiguration {
1713+ {
1714+ Name : "name" ,
1715+ SourceType : plan .FieldArgumentSource ,
1716+ },
1717+ },
1718+ },
1719+ },
1720+ expectedResponse : `{"data":{"hero":{}}}` ,
1721+ }))
1722+
16471723 t .Run ("execute operation and apply input coercion for lists without variables" , runWithoutError (ExecutionEngineTestCase {
16481724 schema : graphql .InputCoercionForListSchema (t ),
16491725 operation : func (t * testing.T ) graphql.Request {
0 commit comments