We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a40a4c0 commit f1a7ef5Copy full SHA for f1a7ef5
src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/models/hmpps/Response.kt
@@ -1,6 +1,8 @@
1
package uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps
2
3
-data class Response<T>(val data: T, val errors: List<UpstreamApiError> = emptyList()) {
+import com.fasterxml.jackson.annotation.JsonInclude
4
+
5
+data class Response<T>(val data: T, @JsonInclude(JsonInclude.Include.NON_EMPTY) val errors: List<UpstreamApiError> = emptyList()) {
6
companion object {
7
fun <T> merge(responses: List<Response<List<T>>>): Response<List<T>> = Response(data = responses.flatMap { it.data }, errors = responses.flatMap { it.errors })
8
}
0 commit comments