Closed kael-shipman closed 7 months ago
"nullable" isn't a JSON Schema keyword; I think it's an OpenAPI extension. You're probably looking to add "null" to the list of "type" values:
{ "type": ["object", "null"] }
fwiw I just tried
const schema = {
type: "object"
required: ["myval"],
properties: {
myval: {
type: ["string", "null"],
enum: ["one", "two"],
}
}
}
And it still didn't work. But my other work-around works fine, so I'll just use that.
On version 1.4.1 / node 20
I don't know if this is a problem for other datatypes; I just know it's a problem for string enums.
To reproduce:
Current solution is to use
oneOf
instead: