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.
This commit is contained in:
Ashley Bennett 2026-04-27 03:38:27 +01:00
parent 9c84690a07
commit df3ded9f67
2 changed files with 1 additions and 3 deletions

View file

@ -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,

View file

@ -113,7 +113,7 @@ class UserControllerTest(
jsonPath("$.sharedLibrariesId") { doesNotExist() }
jsonPath("$.labelsAllow") { isEmpty() }
jsonPath("$.labelsExclude") { isEmpty() }
jsonPath("$.ageRestriction") { doesNotExist() }
jsonPath("$.ageRestriction") { isEmpty() }
}
}
}