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

Schema module generation without operations #3508

Closed
jaikumar-b opened this issue Jan 26, 2025 · 2 comments
Closed

Schema module generation without operations #3508

jaikumar-b opened this issue Jan 26, 2025 · 2 comments
Labels
question Issues that have a question which should be addressed

Comments

@jaikumar-b
Copy link

jaikumar-b commented Jan 26, 2025

Typescript and Kotlin both have options to generate schema types without specifying operations, this would allow to have a single schema module that can be consumed by all modules. We have a huge graph with 6000+ types, and would like to explore the idea of producing an xcframework of schema types to speed up build times. Understandably it would add types that the app may never use, but if were willing to accept the downside of additionally types for better productivity, it could be worth the trade off. Unfortunately, I couldn't an option for this on iOS. Is this something thats going to be supported? If not, any pointers on how we can add this to our folk of codegen so that we can enable this on our end?

@jaikumar-b jaikumar-b added the question Issues that have a question which should be addressed label Jan 26, 2025
@calvincestari
Copy link
Member

HI @jaikumar-b - I think the module configuration you want is already supported.

The file output options in the codegen configuration allow you to configure schema types and operations separately.

For the schema types you'll want to use a module type of either embeddedInTarget or swiftPackage. embeddedInTarget requires you to configure and maintain the target module, whereas swiftPackage is the more automatic option; either way though you'll be getting a separate module for the schema types.

The operations configuration is where you get to separate operations from schema types through using either a relative or absolute configuration option.

Understandably it would add types that the app may never use, but if were willing to accept the downside of additionally types for better productivity, it could be worth the trade off.

There is no way to configure Apollo iOS to generate schema types for all types as it will produce Swift types for only those that are used in operations, and at least one operation is required for code generation. Note that we do have an open issue to correct some of this behaviour.

I'm going to close this issue because I think what you need is already supported. If after reading the documentation and trying the output options it's still not what you're looking for, then comment back in this issue and we can take another look.

Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issues that have a question which should be addressed
Projects
None yet
Development

No branches or pull requests

2 participants