Stylianos Gakis
11/07/2022, 1:38 PMQueryBuilder
, at least on the first level. Meaning I could try and assign the wrong field inside my lambda. I assume this is normal and simply a tradeoff of data builders vs test builders which don’t let you assign the wrong fields in the type of object you want to create right? After going 1 level deep with buildX
though then it’s all type-safe as far as I can tell so that’s great.Stylianos Gakis
11/07/2022, 2:17 PMbuildX
names for creating the objects (no longer confusing with the type itself) and I can simply pass in the LocalDate
without having to use the adapter which we are using for this type to kinda hack my way into using the type and turning it into a JSON String.
Just had to change my fake resolver to avoid initializing lists from
@OptIn(ApolloExperimental::class)
object TestDataTestResolver : DefaultTestResolver() {
override fun resolveListSize(path: List<Any>): Int {
return 0
}
}
to
object TestFakeResolver : FakeResolver by DefaultFakeResolver(__Schema.all) {
override fun resolveListSize(context: FakeResolverContext): Int {
return 0
}
}
And that was it, it seems to just work 🤯
Never fail to impress me with the stuff you folks are doing!mbonnin
11/07/2022, 2:20 PM1. Is the idea for Data builders to completely replace test builders or would they both live in parallel to achieve different goals?I think we want to remove the test builders eventually because they are response based and are therefore prone to the exponential blowup issue
mbonnin
11/07/2022, 2:20 PM2. Meaning I could try and assign the wrong field inside my lambda. I assume this is normal and simply a tradeoff of data builders vs test builders which don’t let you assign the wrong fields in the type of object you want to create rightYes, data builders are not as type safe because they are generated once for the schema (and not per-operation)
mbonnin
11/07/2022, 2:29 PMStylianos Gakis
11/07/2022, 2:31 PMbuildX
functions is type-safe, so it shouldn’t be a big issue.mbonnin
11/07/2022, 2:31 PMall steps after that using thesorry to disappoint but it's not 🙈functions is type-safebuildX
Stylianos Gakis
11/07/2022, 2:31 PMmbonnin
11/07/2022, 2:32 PMmbonnin
11/07/2022, 2:32 PMmbonnin
11/07/2022, 2:33 PMStylianos Gakis
11/07/2022, 2:33 PMupcomingAgreementDetailsTable = buildTable {
it works, but if I try and do upcomingAgreementDetailsTable = buildContract {
it doesn’t let me, since the return types are wrong.
I understand the over or under adding fields. But tbf in test builders you also had the problem of not adding fields and then they’d auto-generate something for you isn’t that true?mbonnin
11/07/2022, 2:34 PMmbonnin
11/07/2022, 2:34 PMmbonnin
11/07/2022, 2:34 PMStylianos Gakis
11/07/2022, 2:35 PMmbonnin
11/07/2022, 2:36 PMStylianos Gakis
11/07/2022, 4:44 PMbuild
prefix really helps me mentally differentiate which one is which. I felt like needing to use this.
before as can be seen on that PR, but not anymore.