So speaking of more multi-module stuff. I got a qu...
# apollo-kotlin
s
So speaking of more multi-module stuff. I got a query like this in one module
Copy code
query CrossSells {
  currentMember {
    id
    crossSells {
      id
      title ... and more here
    }
  }
}
And this one in another module
Copy code
query CrossSellIds {
  currentMember {
    crossSells {
      id
    }
  }
}
This results in a duplicate error, like
duplicate Type 'ResolverKey(kind=SchemaType, id=CrossSell)' generated in modules: :feature-x,:feature-y
This is because it can not understand how to handle generating the data builder for
crossSells
right?
It does suggest me to do
Use 'alwaysGenerateTypesMatching' in a parent module to generate the type only once
crossSells
returns
[CrossSell!]!
so Adding
alwaysGenerateTypesMatching.set(listOf("CrossSell"))
fixes this. Is this also another thing which would be solved in 4.x with
isADependencyOf
and
dependsOn
? Does it know how to handle this in those scenarios?
m
That will be handled automatically in 4.x with
isADependencyOf
🌟 1
The codegen needed to be split in 2 steps: first step to detect the used types and propagate these use types upstream to have them generated in the schema module
Then 2nd step uses the types generated in the schema module in all the feature modules
The setup isn't trivial but I don't think there's another way around. The alternative is generating all the types in the schema module (
alwaysGenerateTypesMatching.set(listOf("*"))
but this has been found to be slow in multiple occurences
👍 1
s
Yep, makes sense to me!