* @private * @param type * @param schema * @param data * @returns {boolean}
(type, schema, data)
| 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. |
no test coverage detected