Closed mattpolzin closed 3 months ago
Upon further thinking, there was no problem with the current behavior. oneOf
may map semantically well to an enumeration but since it lacks its own identity structurally there's no point in making a distinction between "this thing must not be null because it is either (a) a string or (b) a nullable integer" vs. "this thing can be null or a string or an integer."
Currently, I propagate nullability up from subschemas for
oneOf
/anyOf
/allOf
. This logic should be correct already for the latter two, butoneOf
is a true enumeration of options so I should not weaken a guarantee that e.g. only one of the options is nullable unless one of the options is exactly the.null()
schema. That small tweak to the decoding logic foroneOf
should be considered a bug fix.