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

bug: Defer metadata extension generated incorrectly for module types embeddedInTarget and other #3503

Open
calvincestari opened this issue Jan 20, 2025 · 0 comments · May be fixed by apollographql/apollo-ios-dev#581
Assignees
Labels
codegen Issues related to or arising from code generation

Comments

@calvincestari
Copy link
Member

calvincestari commented Jan 20, 2025

I discovered this while working on the selection set initializers for defer.

To support @defer the GraphQL executor needs to know paths and identifiers associated with the operation selection sets. This is generated into the operation file as an extension on the operation type. This works great for the swiftPackage module type but results in a build error for embeddedInTarget and other.

The problem is that for the embeddedInTarget and other module types the operation file content is wrapped in an extension on the caseless enum which is used for namespacing. The resulting build error is because the defer metadata extension is then placed within the enum extension, which is a Swift build error.

I think there are two possible solutions:

  1. Keep the defer metadata in an extension and move it outside of the enum extension to resolve the build error. This will also likely need some namespacing additions for the embeddedInTarget module type. I think this will be more complicated than it seems because the operation definition template only contains operation related scopes; the code to wrap it in the enum extension is done external to it.
  2. Move the defer metadata from an extension to directly within the operation class definition. This should work for all module types and not need any namespace changes.
@calvincestari calvincestari self-assigned this Jan 20, 2025
@calvincestari calvincestari added the codegen Issues related to or arising from code generation label Jan 20, 2025
@calvincestari calvincestari added this to the `@defer` support milestone Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen Issues related to or arising from code generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant