Closed iivo-k closed 4 weeks ago
I tinkered with this myself and got it to work at least for my case by adding unions with Type.Null() as mentioned in https://github.com/sinclairzx81/typebox/pull/118. Made a pull request too, in case it's helpful: https://github.com/geut/openapi-box/pull/10 Test case isn't exhaustive and I'm not sure if there should be some checks so as not to do this with OpenAPI 3.1.0.
fixed in 5.0.6
I'm having an issue with @geut/openapi-box v5.0.5 (and @sinclair/typebox v0.33.7). Nullable values with OpenAPI schema version 3.0.3 seem to be ignored in the generated types.
results in
which does not allow null.
However when using OpenAPI 3.1.0 with
the result is
which works as expected, allowing null values.
Would it be possible to handle nullable in OpenAPI 3.0.3 like this, generating a null union for nullable fields?