Closed d-lach closed 1 year ago
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
The branch nullable
now has tests to verify that nullable
constraint should work as expected
Please see PR - https://github.com/kristianmandrup/schema-to-yup/pull/143
I receive an error message:
however the field is marked as
nullable
in the schema: