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

Apollo Kotlin 4 limitation #6415

Open
XtreeIvI opened this issue Mar 7, 2025 · 1 comment
Open

Apollo Kotlin 4 limitation #6415

XtreeIvI opened this issue Mar 7, 2025 · 1 comment
Labels
⌛ Waiting for info More information is required ✨ Type: Feature

Comments

@XtreeIvI
Copy link

XtreeIvI commented Mar 7, 2025

Use case

apolloMetadata is no longer supported in Apollo 4

Before migration to 4 i was using apolloMetadata

I have module ::schema
I have module data-user::net which depends on ::schema
data-user::net is abstraction module and only declared graphql fragments
I have data-user::net::impl
data-user::net::impl declared queries and mutations
it depends on ::schema & data-user::net

But without apolloMetadata queries are not generated properly

basically
in both ::net and net:impl modules I was applyin groovy convention plugin

plugins {
    id 'com.apollographql.apollo3'
}

apollo {
    service("service") {
        packageName.set("network.schema")
        useSchemaPackageNameForFragments.set(true)
        generateApolloMetadata.set(true)
    }
}

dependencies {
    apolloMetadata projects.networkSchema
    api projects.networkSchema
}

and additionally in net:impl module

apolloMetadata data-user::net
implementation data-user::net

This approach does not work in Apollo 4. I do not know how to achieve the same behavior.
Basically in Apollo 3 it was as if extending schema and adding dependant modules data, which is no longer the case in Apollo 4 (unless I miss something)

Describe the solution you'd like

Provide mechanism similar to apollo metadata or revert usage of apolloMetadata or provide ability to add multiple dependencies (dependsOn) so each downstream module can add on top of current (eg. fragment/queries/etc)

@BoD
Copy link
Contributor

BoD commented Mar 7, 2025

Hi! The way to configure multiple modules has changed in v4, but unless I'm missing something, your setup should still be supported.

In v4, apolloMetadata() should be replaced by calling dependsOn inside the service. More info here, and you can have a look at a sample project here.

Please let me know if that helps.

@BoD BoD added the ⌛ Waiting for info More information is required label Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌛ Waiting for info More information is required ✨ Type: Feature
Projects
None yet
Development

No branches or pull requests

2 participants