Kevin
07/17/2023, 12:00 PM@Serializable
data class Request(
val constraints: List<Constraint>
...
)
@Serializable
sealed class Constraint
@Serializable
object Overlap : Constraint()
@Serializable
data class Overtime(val maxTime: Int) : Constraint()
If someone sends a request that has an invalid Constraint
, I would like a nice message like:
<some_bogus_constraint> is not a valid constraint. Valid constraints are: [Overlap, Overtime]
or
Overtime constraint requires <maxTime>, but it was not provided
How can I accomplish this?Kevin
07/17/2023, 12:01 PMribesg
07/18/2023, 1:14 PMKevin
07/19/2023, 11:04 AMribesg
07/19/2023, 11:54 AM@Resource
in its own file with its full path (I'm not using the "parent" thing, makes it harder to understand for newcomers), and then inside each resource I have my payload model, response model and OpenAPI documentationKevin
07/19/2023, 3:14 PM