Skip to content

How to use OneOf? #2365

Answered by oldergod
DenisVoronets asked this question in Q&A
Dec 19, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

oneofs fields are inlined. We do a null check on each one of those fields until we find the one set. On top of it, we have a runtime check which throws if more than one field within a oneof is set. We don't offer ways to smartcast the set fields; that might be doable with extension functions?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DenisVoronets
Comment options

Answer selected by DenisVoronets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants