kotlinx.serialization icon indicating copy to clipboard operation
kotlinx.serialization copied to clipboard

`buildClassSerialDescriptor` does not create nullable descriptor

Open sandwwraith opened this issue 3 years ago • 0 comments

Originally reported as https://youtrack.jetbrains.com/issue/KT-52300

To Reproduce

val descriptor = buildClassSerialDescriptor("FooBar") {
    isNullable = true
}
assertTrue(descriptor.isNullable) // throws

Expected behavior

Either we should allow to create nullable descriptors via builder or remove nullable property from it, leaving only descriptor.nullable extension. The latter would always append ? to serial name.

Environment

  • Library version: 1.3.2

sandwwraith avatar May 06 '22 12:05 sandwwraith