Jan Skrasek
05/10/2022, 9:39 AMval data = UserDataQuery.Data {
viewer = userViewer {
userId = "userId"
identity = identity {
email = "<mailto:jon.snow@example.com|jon.snow@example.com>"
name = name {
first = "Jon"
last = "Snow"
}
}
preferredTrips = preferredTrips {
edges = listOf(edge { node = node { kind = "MUSIC" } })
}
}
}
This was my first attempt:
val data = UserDataQuery.Data {
userViewer {
userId = "userId"
identity {
email = "<mailto:jon.snow@example.com|jon.snow@example.com>"
name {
first = "Jon"
last = "Snow"
}
}
preferredTrips {
edge { node { kind = "MUSIC" } }
}
}
}
Have you considered something like this?mbonnin
05/10/2022, 9:39 AMJan Skrasek
05/10/2022, 9:40 AMmbonnin
05/10/2022, 9:41 AMuserViewer
is called and not stored into one field, it throws a runtime errorpreferredTrips {
edge { node { kind = "MUSIC" } }
edge { node { kind = "VIDEO" } }
}
Stylianos Gakis
05/10/2022, 10:17 AMidentity = identity {...}
. I am not sure if the ambiguity would be worth it with the other approach. Just throwing my opinion out there 😅mbonnin
05/10/2022, 10:19 AMJan Skrasek
05/10/2022, 10:42 AMbod
05/10/2022, 10:42 AMJan Skrasek
05/10/2022, 10:44 AMbod
05/10/2022, 11:05 AMmbonnin
05/10/2022, 1:20 PMStylianos Gakis
05/19/2022, 9:58 AMbod
05/19/2022, 10:02 AMStylianos Gakis
05/19/2022, 10:05 AMreturn
keyword, on the next line, showing it off as Unreachable code
, and the return keyword with “This function must return a value of type Map<String, Any?>”
Aka the code is parsed wrong, and this is one of the few cases where I guess it’d work if Kotlin had semicolons right 😂
In one of my test builders, this is generated:
public
fun additionalPaymentsDetailsResponseFinishedSubmitAdditionalPaymentDetails(block: AdditionalPaymentsDetailsResponseFinishedSubmitAdditionalPaymentDetailsBuilder.() -> Unit
= {}): Map<String, Any?> {
__shouldBeAssignedFields.add("submitAdditionalPaymentDetails")
return
AdditionalPaymentsDetailsResponseFinishedSubmitAdditionalPaymentDetailsBuilder().apply(block).build()
}
while what should’ve been generated and would work is this
public
fun additionalPaymentsDetailsResponseFinishedSubmitAdditionalPaymentDetails(block: AdditionalPaymentsDetailsResponseFinishedSubmitAdditionalPaymentDetailsBuilder.() -> Unit
= {}): Map<String, Any?> {
__shouldBeAssignedFields.add("submitAdditionalPaymentDetails")
return AdditionalPaymentsDetailsResponseFinishedSubmitAdditionalPaymentDetailsBuilder().apply(block).build()
}
bod
05/20/2022, 11:39 AMStylianos Gakis
05/20/2022, 11:43 AMbod
05/20/2022, 11:44 AMStylianos Gakis
05/20/2022, 11:47 AMbod
05/20/2022, 12:04 PMreturn
cases. We've been using the character in some places but not all...Stylianos Gakis
05/20/2022, 12:07 PMbod
05/20/2022, 12:08 PMStylianos Gakis
05/20/2022, 12:20 PMbod
05/20/2022, 12:20 PM