Nullable value not evaulated properly
d-lach opened this issue · comments
Dominik Lach commented
Kristian Mandrup commented
This is the constraint logic for applying nullable (in mixed.js
) where value
is the actual JSON schema constraint object (ie in terms of key/value) where key is the property name.
nullable() {
const nullable = this.value.nullable === true;
this.base = (nullable && this.base.nullable()) || this.base;
return this;
}
nullable
methid should be called since it is part of
get mixedEnabled() {
return (
this.mixedConfig.enabled || [
"oneOf",
"notOneOf",
"when",
"nullable",
"isType",
"label",
"const",
"refValueFor",
]
);
}
get enabled() {
return [...this.mixedEnabled, ...this.$typeEnabled];
}
convertEnabled() {
this.enabled.map((name) => {
const convertFn = this.convertFnFor(name);
if (convertFn) {
convertFn(this);
}
});
}
You can debug it by applying detailed logging as described in the docs
Kristian Mandrup commented
The branch nullable
now has tests to verify that nullable
constraint should work as expected
Kristian Mandrup commented
Please see PR - #143