|
|
@@ -138,7 +138,7 @@ export const fieldsToPayload = (
|
|
|
Object.keys(usableSchema.properties).forEach(fieldName => {
|
|
|
if (data[fieldName] !== undefined && typeof data[fieldName] !== "object") {
|
|
|
info[fieldName] = Utils.trim(fieldName, data[fieldName]);
|
|
|
- } else if (typeof usableSchema.properties[fieldName] === "object") {
|
|
|
+ } else if (usableSchema.properties[fieldName].type === "object") {
|
|
|
const properties =
|
|
|
usableSchema.properties[fieldName] &&
|
|
|
usableSchema.properties[fieldName].properties;
|
|
|
@@ -154,10 +154,8 @@ export const fieldsToPayload = (
|
|
|
});
|
|
|
}
|
|
|
} else if (
|
|
|
- !data[fieldName] &&
|
|
|
- usableSchema.required &&
|
|
|
- usableSchema.required.find((f: string) => f === fieldName) &&
|
|
|
- usableSchema.properties[fieldName].default
|
|
|
+ data[fieldName] === undefined &&
|
|
|
+ usableSchema.properties[fieldName].default !== undefined
|
|
|
) {
|
|
|
info[fieldName] = usableSchema.properties[fieldName].default;
|
|
|
}
|