|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
/* eslint-disable no-console */
|
|
|
|
|
import widgets from "widgets/widgets";
|
|
|
|
|
import createLogger from "utils/logger";
|
|
|
|
|
|
|
|
|
|
const logger = createLogger("validateWidgetData");
|
|
|
|
|
|
|
|
|
|
export default function validateWidgetData(widget, endpoint, data) {
|
|
|
|
|
let valid = true;
|
|
|
|
@ -33,7 +36,7 @@ export default function validateWidgetData(widget, endpoint, data) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!valid) {
|
|
|
|
|
console.warn(
|
|
|
|
|
logger.error(
|
|
|
|
|
`Invalid data for widget '${widget.type}' endpoint '${endpoint}':\nExpected:${mapping?.validate}\nParse error: ${
|
|
|
|
|
error ?? "none"
|
|
|
|
|
}\nData: ${JSON.stringify(data)}`,
|
|
|
|
|