1

I'm getting a compilation error from one of my apollo tasks, as Android Studio attempts to generate the classes based on the given schema(s).

I've got two services/endpoints that I'm referencing in my solution: public & private. They are defined as follows in my app/gradle.build:

apollo {
    graphqlSourceDirectorySet.srcDirs += "./src/main/graphql"

    service("private") {
        sourceFolder = "./com/myapp/privateGQL"
        schemaPath = "./com/myapp/privateGQL/schema.json"
    }
    service("public") {
        sourceFolder = "./com/myapp/publicGQL"
        schemaPath = "./com/myapp/publicGQL/schema.json"
    }

    generateKotlinModels = true
    customTypeMapping = [
        "URL" : "java.lang.String",
        "Date" : "java.util.Date"
    ]
}

Inside the privateGQL directory I have a query, GetBusinessQuery.graphql.

Inside the publicGQL directory I have a mutation, TokenGetOrCreate.graphql, which has a custom input parameter, TokenGetOrCreateInput.

The problem is the 'generateDebugPrivateApolloSources', is failing with the following error:

Failed to parse GraphQL file. Unknown variable type 'TokenGetOrCreateInput!'

The TokenGetOrCreateInput type is defined in the publicGQL/schema.json, but for some reason the 'private' set of tasks are also expecting a definition of this type, which of course, the privateGQL/schema.json doesn't contain.

How do I exclude publicGQL/*.graphql files from be included in the compilation tasks on the private service, and vice versa?

0 Answers0