From: Bob Gallagher Date: Thu, 20 Apr 2017 21:31:19 +0000 (-0400) Subject: Fix serialization of a leaf-list field. X-Git-Tag: v2.0.1~17 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=commitdiff_plain;h=35808a0905d96e45bbe68c9b19cda2b673e1f9a6;ds=sidebyside Fix serialization of a leaf-list field. Change-Id: I313bfc02d6a6311ef096ca28527153465c131271 Signed-off-by: Bob Gallagher --- diff --git a/skyquake/plugins/composer/src/src/libraries/model/DescriptorModelMetaFactory.js b/skyquake/plugins/composer/src/src/libraries/model/DescriptorModelMetaFactory.js index 69098ec2d..1ba891256 100644 --- a/skyquake/plugins/composer/src/src/libraries/model/DescriptorModelMetaFactory.js +++ b/skyquake/plugins/composer/src/src/libraries/model/DescriptorModelMetaFactory.js @@ -102,19 +102,15 @@ function serialize_leaf_empty(data) { function serialize_leaf_list(data) { data = data[this.name]; if (data) { - commaSeparatedValues = data.reduce((d, v) => { - let leaf = Serializer.leaf.call(this, d); - let value = leaf & leaf[this.name]; - if (value && value.length) { - if (v.length) { - v += ', '; - } - v += value; + data = data.reduce((result, value) => { + if (value !== '' && value !== null && value !== undefined && typeof value !== 'object') { + result.push(value); } - }, ""); - if (commaSeparatedValues.length) { + return result; + }, []); + if (data.length){ let obj = {}; - obj[this.name] = commaSeparatedValues; + obj[this.name] = data; return obj; } }