diff --git a/packages/icon-build-helpers/src/metadata/extensions/icons.js b/packages/icon-build-helpers/src/metadata/extensions/icons.js index 7ceec89bb5ec..e175a0947f57 100644 --- a/packages/icon-build-helpers/src/metadata/extensions/icons.js +++ b/packages/icon-build-helpers/src/metadata/extensions/icons.js @@ -30,7 +30,7 @@ const icons = () => { Joi.string().valid('glyph'), Joi.number().valid([16, 20, 24, 32]) ), - aliases: Joi.array(), + aliases: Joi.array().items(Joi.string()), }) ), diff --git a/packages/icon-build-helpers/src/metadata/extensions/pictograms.js b/packages/icon-build-helpers/src/metadata/extensions/pictograms.js index 035ebb386010..c4d0151ee910 100644 --- a/packages/icon-build-helpers/src/metadata/extensions/pictograms.js +++ b/packages/icon-build-helpers/src/metadata/extensions/pictograms.js @@ -22,7 +22,7 @@ const pictograms = () => { Joi.object().keys({ name: Joi.string().required(), friendly_name: Joi.string().required(), - aliases: Joi.array(), + aliases: Joi.array().items(Joi.string()), }) ), diff --git a/packages/icon-build-helpers/src/metadata/validate.js b/packages/icon-build-helpers/src/metadata/validate.js index 18402c06f098..48f452ce40b9 100644 --- a/packages/icon-build-helpers/src/metadata/validate.js +++ b/packages/icon-build-helpers/src/metadata/validate.js @@ -8,6 +8,7 @@ 'use strict'; const Joi = require('joi'); +const { reporter } = require('@carbon/cli-reporter'); /** * Validate the given icons and extension metadata against the asset registry @@ -21,9 +22,18 @@ const Joi = require('joi'); function validate(registry, extensions = []) { for (const extension of extensions) { if (extension.schema) { - const { error } = Joi.validate(extension.data, extension.schema); + const { error, value } = Joi.validate(extension.data, extension.schema); if (error) { - throw new Error(error.annotate()); + const failedAssets = error.details.map(({ path, message }) => ({ + index: path[0], + message, + })); + reporter.error(`Unable to validate the ${extension.name} extension:`); + failedAssets.forEach((asset) => { + reporter.error(`Error: ${asset.message}`); + reporter.info(JSON.stringify(value[asset.index], null, 2)); + }); + process.exit(1); } } diff --git a/packages/pictograms/pictograms.yml b/packages/pictograms/pictograms.yml index 05b3315803a1..f4a1e6d0a61d 100644 --- a/packages/pictograms/pictograms.yml +++ b/packages/pictograms/pictograms.yml @@ -3269,16 +3269,13 @@ - soft ice cream - ice cream - food - - name: softlayer--enablement - friendly_name: Softlayer enablement - aliases: - - softlayer enablement - - enablement - - softlayer - - cloud - name: softlayer--enablement - friendly_name: softlayer--enablement - aliases: [] + friendly_name: Softlayer enablement + aliases: + - softlayer enablement + - enablement + - softlayer + - cloud - name: solar--field friendly_name: Solar field aliases: