-
Notifications
You must be signed in to change notification settings - Fork 745
Closed
apollographql/apollo-ios-dev
#709Labels
bugGenerally incorrect behaviorGenerally incorrect behaviorcodegenIssues related to or arising from code generationIssues related to or arising from code generation
Description
Summary
When using @defer
in nested fragment spreads, the Apollo iOS codegen tool doesn't initialize the corresponding @deferred properties in the generated Fragments struct. This issue seems to occur specifically when the @defer
directive is applied to a fragment spread nested inside another fragment.
Version
1.23.0
Steps to reproduce the behavior
- Create the following schema
type Query {
user(id: ID!): User!
}
type User {
id: ID!
email: String!
name: String!
}
- add this query
query getUser($id: ID!) {
user(id: $id) {
...UserDetail
}
}
fragment UserDetail on User {
id
...UserInfo @defer(label: "userInfo")
}
fragment UserInfo on User {
email
name
}
- run the codegen with this configuration
{
"schemaNamespace": "MySchema",
"input": {
"operationSearchPaths": ["./Operations/**/*.graphql"],
"schemaSearchPaths": ["./Schema/**/*.graphql"]
},
"output": {
"testMocks": {
"none": {}
},
"schemaTypes": {
"path": "./Generated",
"moduleType": {
"embeddedInTarget": {
"name": "MyTarget",
"accessModifier": "public"
}
}
},
"operations": {
"inSchemaModule": {}
}
},
"options": {
"deprecatedEnumCases": "exclude",
"pruneGeneratedFiles": true,
"operationDocumentFormat": ["definition", "operationId"],
"selectionSetInitializers": {
"namedFragments": true
}
},
"operationManifest": {
"generateManifestOnCodeGeneration": true,
"path": "./Generated/operationIDs.json",
"version": "persistedQueries"
}
}
- the following error occurs

Logs
Anything else?
No response
Metadata
Metadata
Assignees
Labels
bugGenerally incorrect behaviorGenerally incorrect behaviorcodegenIssues related to or arising from code generationIssues related to or arising from code generation