From df3ded9f67bf1cb2c701313c8e9d38dd260ddbde Mon Sep 17 00:00:00 2001 From: Ashley Bennett Date: Mon, 27 Apr 2026 03:38:27 +0100 Subject: [PATCH] fix(api): return null for UserDto.ageRestriction instead of omitting field Reverts the @JsonInclude(NON_NULL) annotation added in e3a8cc6 which broke external API clients that deserialize KomgaUser with ageRestriction as a required field. Omitting the field entirely causes deserialization errors for clients like komga-client when the admin user has no age restriction set. --- .../kotlin/org/gotson/komga/interfaces/api/rest/dto/UserDto.kt | 2 -- .../org/gotson/komga/interfaces/api/rest/UserControllerTest.kt | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/UserDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/UserDto.kt index 026f9776..ee425a30 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/UserDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/UserDto.kt @@ -1,12 +1,10 @@ package org.gotson.komga.interfaces.api.rest.dto -import com.fasterxml.jackson.annotation.JsonInclude import org.gotson.komga.domain.model.AgeRestriction import org.gotson.komga.domain.model.AllowExclude import org.gotson.komga.domain.model.KomgaUser import org.gotson.komga.infrastructure.security.KomgaPrincipal -@JsonInclude(JsonInclude.Include.NON_NULL) data class UserDto( val id: String, val email: String, diff --git a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/UserControllerTest.kt b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/UserControllerTest.kt index 55d74e1b..3e39faf0 100644 --- a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/UserControllerTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/UserControllerTest.kt @@ -113,7 +113,7 @@ class UserControllerTest( jsonPath("$.sharedLibrariesId") { doesNotExist() } jsonPath("$.labelsAllow") { isEmpty() } jsonPath("$.labelsExclude") { isEmpty() } - jsonPath("$.ageRestriction") { doesNotExist() } + jsonPath("$.ageRestriction") { isEmpty() } } } }