MCPcopy Create free account
hub / github.com/bigcommerce/stencil-cli / _validateJsonSchema

Method _validateJsonSchema

lib/bundle-validator.js:167–178  ·  view source on GitHub ↗

* @private * @param type * @param schema * @param data * @returns {boolean}

(type, schema, data)

Source from the content-addressed store, hash-verified

165 * @returns {boolean}
166 */
167 _validateJsonSchema(type, schema, data) {
168 const validator = new Validator(this.jsonSchemaValidatorOptions);
169 validator.validate(schema, data);
170 if (validator.errors && validator.errors.length > 0) {
171 let errorMessage = `Your theme's ${type}.json has errors:`;
172 for (const error of validator.errors) {
173 errorMessage += `${os.EOL + type + error.dataPath} ${error.message}`;
174 }
175 throw new Error(errorMessage.red);
176 }
177 return true;
178 }
179
180 /**
181 * Ensure that schema translations exists and there are no missing or unused keys.

Callers 2

_validateThemeSchemaMethod · 0.95

Calls 1

validateMethod · 0.80

Tested by

no test coverage detected