Skip to content

What is the purpose of the UNSET constant / class ? #385

Answered by dbanty
skpn asked this question in Q&A
Discussion options

You must be logged in to vote

Hiya @skpn!

The Simple Answer

There are really two answers to this question, so let's start with the simple one. UNSET is a sentinel object of type Unset. We use it in generated clients to determine whether or not a value was passed to a function or class. If you're familiar with JavaScript, this is basically equivalent to undefined, it's just that Python does not give us a built-in way to represent that concept, so libraries have to include their own.

The Complicated Answer

The more complicated answer has to do with how OpenAPI allows you to define values. There are a bunch of different attributes you can use to describe how a particular value should be used, but the relevant ones here are

Replies: 1 comment 1 reply

Comment options

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

Answer selected by dbanty
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