Skip to content

NonNull enum property has null value #373

@rafalbednarczuk

Description

@rafalbednarczuk

Describe the bug
Deserializing "null" string as non-null enum gives null value.

To Reproduce

enum class SocialMediaPlatform {INSTAGRAM, FACEBOOK, YOUTUBE, TWITCH}
fun main() {
    val json = "null"
    val enum  : SocialMediaPlatform = ObjectMapper().readValue(json)
    println(enum == null)
}

this snippet prints true

Expected behavior
Snippet should throw exception

Versions
Kotlin: 1.3.72
Jackson-module-kotlin: 2.11.2
Jackson-databind: 2.11.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions