Closed Andrew-Max closed 4 years ago
I run into the same issue, and I solved the issue by adding an array as a type(Not sure if it is the best solution).
So you can change your schema to look like this:
{
type: "object",
properties: {
product_id: { type: ["string", "null"] },
...
},
required: []
}
And that should work fine.
@stefanosx clever solution. It's hackier than I'd like for something I'm putting into production but it does solve my immediate issue for now. Thanks!
I have a schema:
Note nothing is required here and the only way to set an
undefined
is withnull
So it seems to me like this should be a valid entry
But validation fails telling me that it expected string or numeric types, not null. I explicitly do not want to trim out null properties, I want them to be saved as present with a value of
null
so it is clear to end users which properties exist.Is there any way to accomplish this?