(schema)
| 1096 | ); |
| 1097 | const validateValuesSchema = (valuesSchema) => objValidate(valuesSchema, validateCellOrValueSchema); |
| 1098 | const validateCellOrValueSchema = (schema) => { |
| 1099 | if (!objValidate( |
| 1100 | schema, |
| 1101 | (_child, id2) => arrayHas([TYPE, DEFAULT, ALLOW_NULL], id2) |
| 1102 | )) { |
| 1103 | return false; |
| 1104 | } |
| 1105 | const type = schema[TYPE]; |
| 1106 | if (!isTypeStringOrBoolean(type) && type != NUMBER && !isJsonType(type)) { |
| 1107 | return false; |
| 1108 | } |
| 1109 | const defaultValue = schema[DEFAULT]; |
| 1110 | if (isNull(defaultValue) && !schema[ALLOW_NULL]) { |
| 1111 | return false; |
| 1112 | } |
| 1113 | if (!isNull(defaultValue)) { |
| 1114 | if (getCellOrValueType(defaultValue) != type) { |
| 1115 | objDel(schema, DEFAULT); |
| 1116 | } else { |
| 1117 | schema[DEFAULT] = encodeIfJson(defaultValue); |
| 1118 | } |
| 1119 | } |
| 1120 | return true; |
| 1121 | }; |
| 1122 | const validateContent = isArray; |
| 1123 | const validateTables = (tables) => objValidate(tables, validateTable, cellInvalid); |
| 1124 | const validateTable = (table, tableId) => (!hasTablesSchema || collHas(tablesSchemaMap, tableId) || /* istanbul ignore next */ |
nothing calls this directly
no test coverage detected
searching dependent graphs…