Skip to content

Commit

Permalink
feat: Make SerialDescriptorForNullable.original public
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuckame committed Apr 15, 2024
1 parent d0ae697 commit e555fdf
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,17 @@ public val SerialDescriptor.nullable: SerialDescriptor
return SerialDescriptorForNullable(this)
}

/**
* Returns the serial descriptor previously transformed to nullable with [SerialDescriptor.nullable] back
* to its original form.
*/
@ExperimentalSerializationApi
public val SerialDescriptor.unwrapNonNull: SerialDescriptor
get() = when (this) {
is SerialDescriptorForNullable -> original
else -> this
}

/**
* Builder for [SerialDescriptor] for user-defined serializers.
*
Expand Down

0 comments on commit e555fdf

Please sign in to comment.