scana
05/08/2024, 1:49 PMbase
module and an additional mutation in feature
module, which depends on that base
one.
I see the following inside of a feature
mutation:
public fun Data(resolver: FakeResolver = DefaultFakeResolver(__Schema.all),
block: MutationBuilder.() -> Unit = {}): Data = buildData(
CreateAddressMutation_ResponseAdapter.Data,
CreateAddressMutationSelections.__root,
"Mutation",
GlobalBuilder.buildMutation(block),
resolver,
__CustomScalarAdapters,
)
That MutationBuilder
is in turn located in the base
module and knows nothing about CreateAddressMutation
, so I cannot do something like:
CreateAddressMutation.Data {
createAddress = buildAddressNode {
}
}
because I cannot access "createAddress".
I wonder if I'm approaching the whole concept in a wrong way 🤔scana
05/08/2024, 1:49 PMmutation CreateAddress(
$fullName: String!
$addressLine1: String!
) {
createAddress(
fullName: $fullName
line1: $addressLine1
) {
address {
...Address
}
}
}
Stylianos Gakis
05/08/2024, 1:55 PMStylianos Gakis
05/08/2024, 1:56 PMscana
05/08/2024, 2:00 PMIs this perhaps a matter of your main module having to know which types are in fact needed so that it knows to generate all the code for them?It's not necessarily the type itself, just the mutation / query - unless that's considered a "type" as well?
Stylianos Gakis
05/08/2024, 2:57 PMscana
05/08/2024, 3:45 PMalwaysGenerateTypesMatching
🤔
Given this schema:
createAddress(
city: String
fullName: String
): CreateAddressMutation
type CreateAddressMutation {
address: AddressNode
}
I tried the following:
alwaysGenerateTypesMatching.set(
[
...
"CreateAddressMutation"
...
]
But the MutationBuilder
does not seem to pick it up - I suppose I could have just keep that mutation declared within the base module, but it kills the multi-module setup.Stylianos Gakis
05/08/2024, 6:18 PMStylianos Gakis
05/08/2024, 6:19 PMscana
05/08/2024, 8:22 PMscana
05/09/2024, 10:09 AM.*
does work - I'll try to figure out required steps now.
@mbonnin I feel bad for pinging you again but maybe you have some ideas on how to satisfy types generation for mutations to show up in a MutationBuilder 😅Stylianos Gakis
05/09/2024, 10:12 AMscana
05/09/2024, 10:18 AMscana
05/09/2024, 10:38 AM".*createAddress",
"CreateAddressMutation",
and now it works:
public var createAddress: CreateAddressMutationMap? by __fields
Although it still does not generate AddressNode inside of it, despite adding "AddressNode" - I'll keep digging.scana
05/09/2024, 10:46 AM".*createAddress",
"CreateAddressMutation.*",
Otherwise it won't include mutation response fields. I wonder if there is some verbose mode which would let me see how those types are actually named 🤔