diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2026-06-11 17:29:21 -0300 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2026-06-11 17:29:21 -0300 |
| commit | 7b04db33ff3b14e90e213b032864038baf64e694 (patch) | |
| tree | e9710792e379b0e06a91167fa6c8b73496997ca1 /src/data | |
| parent | cc1a01870e287a756633e43b6f6d437434c4af32 (diff) | |
yaml: drop select fields in invalidFieldCombinations
Diffstat (limited to 'src/data')
| -rw-r--r-- | src/data/yaml.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js index f8591311..0c1e76bc 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -229,7 +229,7 @@ function makeProcessDocument(thingConstructor, { const fieldCombinationErrors = []; - for (const {message, fields: fieldsSpec} of invalidFieldCombinations) { + for (const {message, fields: fieldsSpec, drop} of invalidFieldCombinations) { const fieldsPresent = fieldsSpec.flatMap(fieldSpec => { if (Array.isArray(fieldSpec)) { @@ -259,7 +259,12 @@ function makeProcessDocument(thingConstructor, { fieldsSpec, message)); - for (const field of Object.keys(filteredDocument)) { + const dropFields = + (drop + ? Object.keys(filteredDocument).filter(key => drop.includes(key)) + : Object.keys(filteredDocument)); + + for (const field of dropFields) { skippedFields.add(field); } } |