Jo茫o Gabriel Z贸
08/22/2023, 4:35 PMFrancis Altomare
08/22/2023, 4:41 PM@JsonTypeInfo(use = DEDUCTION)
@JsonSubTypes(
Type(A::class),
Type(B::class),
)
sealed class MyRequest {
data class A(val someInt: Int) : MyRequest()
data class B(val someString: String, val someOtherType: Float) : MyRequest()
}
@PostMapping
fun someControllerMethod(@RequestBody myRequest: MyRequest) = when(myRequest) {
}
Jo茫o Gabriel Z贸
08/22/2023, 5:06 PMJo茫o Gabriel Z贸
08/22/2023, 7:09 PMFrancis Altomare
08/22/2023, 7:10 PMDEDUCTION
that will let you use a selector to determine the typeeddMX
08/22/2023, 7:58 PMeddMX
08/22/2023, 7:58 PMeddMX
08/22/2023, 7:58 PMJacob
08/23/2023, 1:05 PM