Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify fragment protocols to support deferred properties #3140

Closed
Tracked by #3093
calvincestari opened this issue Jul 24, 2023 · 0 comments
Closed
Tracked by #3093

Modify fragment protocols to support deferred properties #3140

calvincestari opened this issue Jul 24, 2023 · 0 comments
Assignees

Comments

@calvincestari
Copy link
Member

calvincestari commented Jul 24, 2023

This is the more general fragment work mentioned in the Generated models section of the RFC. This will probably have a dependency on #3139 being completed first.

Regardless of the fragment/field solution chosen all deferred fragment definitions in generated models __selections will get an additional property to indicate they are deferred. This helps to understand the models when reading them as well as being used by internal code.

// Updated Selection enum
public enum Selection {
  // other cases not shown
  case fragment(any Fragment.Type, deferred: Bool)
  case inlineFragment(any InlineFragment.Type, deferred: Bool)

  // other properties and types not shown
}

// Sample usage in a generated model
public class ExampleQuery: GraphQLQuery {
  // other properties and types not shown

  public struct Data: ExampleSchema.SelectionSet {
    public static var __selections: [ApolloAPI.Selection] { [
      .fragment(EntityFragment.self, deferred: true),
      .inlineFragment(AsEntity.self, deferred: true),
    ] }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant