Cleansing input rows against the table schema.
This commit is contained in:
parent
a367acfd74
commit
6c2f0f5917
|
@ -171,8 +171,9 @@ exports.inputProcessing = (user = {}, table, row) => {
|
||||||
const copiedTable = cloneDeep(table)
|
const copiedTable = cloneDeep(table)
|
||||||
for (let [key, value] of Object.entries(clonedRow)) {
|
for (let [key, value] of Object.entries(clonedRow)) {
|
||||||
const field = table.schema[key]
|
const field = table.schema[key]
|
||||||
|
// cleanse fields that aren't in the schema
|
||||||
if (!field) {
|
if (!field) {
|
||||||
continue
|
delete clonedRow[key]
|
||||||
}
|
}
|
||||||
clonedRow[key] = exports.coerce(value, field.type)
|
clonedRow[key] = exports.coerce(value, field.type)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue