vine icon indicating copy to clipboard operation
vine copied to clipboard

Validation for undefined only

Open Desalutar20 opened this issue 1 year ago • 1 comments

Hi, is there any way to explicitly specify that a field can only be undefined and not null ? In the current implementation optional() considers null as valid too, although there is nullable() for this purpose Image

Desalutar20 avatar May 13 '25 04:05 Desalutar20

I am also struggling with this. I am trying to extend Tuyau's experimental openapi generator, and this is giving me a headache.

optional() js docs say An optional field allows both null and undefined values. nullable() js docs says If optional and nullable are used together, then both undefined and null values will be allowed.

So I am not understanding the difference.

camerontredoux avatar Nov 28 '25 08:11 camerontredoux