pg-mvc-service 2.0.117 → 2.0.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -207,12 +207,7 @@ class RequestType extends ReqResType_1.default {
207
207
  break;
208
208
  }
209
209
  errorMessage = errorMessage.replace("{property}", keys.join('.'));
210
- if (value === undefined) {
211
- errorMessage = errorMessage.replace("{value}", value);
212
- }
213
- else {
214
- errorMessage = errorMessage.replace("{value}", "");
215
- }
210
+ errorMessage = errorMessage.replace("{value}", value !== null && value !== void 0 ? value : "");
216
211
  return errorMessage;
217
212
  }
218
213
  /**
@@ -1049,7 +1044,9 @@ class RequestType extends ReqResType_1.default {
1049
1044
  code: code + '-ARRAY_01',
1050
1045
  description: this.createErrorMessage('ARRAY_01', [key])
1051
1046
  });
1047
+ console.log(property.description, property.type);
1052
1048
  errorList = [...errorList, ...this.getErrorArray([key], code)];
1049
+ console.log("errorList", errorList);
1053
1050
  break;
1054
1051
  case 'map':
1055
1052
  case 'map?':
@@ -1125,7 +1122,7 @@ class RequestType extends ReqResType_1.default {
1125
1122
  code: code + '-ARRAY_11',
1126
1123
  description: this.createErrorMessage('ARRAY_11', [...keys, key]),
1127
1124
  });
1128
- errorList = [...errorList, ...this.getErrorArray([key], code)];
1125
+ errorList = [...errorList, ...this.getErrorArray([...keys, key, 0], code)];
1129
1126
  break;
1130
1127
  case 'map':
1131
1128
  case 'map?':
@@ -1173,6 +1170,7 @@ class RequestType extends ReqResType_1.default {
1173
1170
  getErrorArray(keys, code) {
1174
1171
  let errorList = [];
1175
1172
  const property = this.getProperty(keys);
1173
+ console.log(keys, property);
1176
1174
  if (property.type !== 'array' && property.type !== 'array?') {
1177
1175
  throw new Error(`setArrayメソッドでArray型以外が入力された場合はエラー\n keys: ${keys.join(',')}`);
1178
1176
  }
@@ -1307,20 +1305,20 @@ class RequestType extends ReqResType_1.default {
1307
1305
  errorList.push({
1308
1306
  status: 400,
1309
1307
  code: isRequestBody ? code + "-STRING_21" : code + "-STRING_91",
1310
- description: this.createErrorMessage(isRequestBody ? "BOOL_23" : "BOOL_93", keys)
1308
+ description: this.createErrorMessage(isRequestBody ? "STRING_21" : "STRING_91", keys)
1311
1309
  });
1312
1310
  if (property.maxLength !== undefined) {
1313
1311
  errorList.push({
1314
1312
  status: 400,
1315
1313
  code: isRequestBody ? code + "-STRING_22" : code + "-STRING_92",
1316
- description: this.createErrorMessage(isRequestBody ? "BOOL_23" : "BOOL_93", keys)
1314
+ description: this.createErrorMessage(isRequestBody ? "STRING_22" : "STRING_92", keys)
1317
1315
  });
1318
1316
  }
1319
1317
  if (property.regExp !== undefined) {
1320
1318
  errorList.push({
1321
1319
  status: 400,
1322
1320
  code: isRequestBody ? code + "-STRING_23" : code + "-STRING_93",
1323
- description: this.createErrorMessage(isRequestBody ? "BOOL_23" : "BOOL_93", keys)
1321
+ description: this.createErrorMessage(isRequestBody ? "STRING_23" : "STRING_93", keys)
1324
1322
  });
1325
1323
  }
1326
1324
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-mvc-service",
3
- "version": "2.0.117",
3
+ "version": "2.0.119",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
6
6
  "bugs": {
@@ -248,11 +248,7 @@ export class RequestType extends ReqResType {
248
248
  }
249
249
 
250
250
  errorMessage = errorMessage.replace("{property}", keys.join('.'));
251
- if (value === undefined) {
252
- errorMessage = errorMessage.replace("{value}", value);
253
- } else {
254
- errorMessage = errorMessage.replace("{value}", "");
255
- }
251
+ errorMessage = errorMessage.replace("{value}", value ?? "");
256
252
 
257
253
  return errorMessage;
258
254
  }
@@ -1153,7 +1149,9 @@ export class RequestType extends ReqResType {
1153
1149
  description: this.createErrorMessage('ARRAY_01', [key])
1154
1150
  });
1155
1151
 
1152
+ console.log(property.description, property.type)
1156
1153
  errorList = [...errorList, ...this.getErrorArray([key], code)];
1154
+ console.log("errorList", errorList)
1157
1155
  break;
1158
1156
  case 'map':
1159
1157
  case 'map?':
@@ -1236,7 +1234,7 @@ export class RequestType extends ReqResType {
1236
1234
  description: this.createErrorMessage('ARRAY_11', [...keys, key]),
1237
1235
  });
1238
1236
 
1239
- errorList = [...errorList, ...this.getErrorArray([key], code)];
1237
+ errorList = [...errorList, ...this.getErrorArray([...keys, key, 0], code)];
1240
1238
  break;
1241
1239
  case 'map':
1242
1240
  case 'map?':
@@ -1287,6 +1285,7 @@ export class RequestType extends ReqResType {
1287
1285
  let errorList: Array<IError> = [];
1288
1286
 
1289
1287
  const property = this.getProperty(keys);
1288
+ console.log(keys, property);
1290
1289
  if (property.type !== 'array' && property.type !== 'array?') {
1291
1290
  throw new Error(`setArrayメソッドでArray型以外が入力された場合はエラー\n keys: ${keys.join(',')}`);
1292
1291
  }
@@ -1427,14 +1426,14 @@ export class RequestType extends ReqResType {
1427
1426
  errorList.push({
1428
1427
  status: 400,
1429
1428
  code: isRequestBody ? code + "-STRING_21" : code + "-STRING_91",
1430
- description: this.createErrorMessage(isRequestBody ? "BOOL_23" : "BOOL_93", keys)
1429
+ description: this.createErrorMessage(isRequestBody ? "STRING_21" : "STRING_91", keys)
1431
1430
  });
1432
1431
 
1433
1432
  if (property.maxLength !== undefined) {
1434
1433
  errorList.push({
1435
1434
  status: 400,
1436
1435
  code: isRequestBody ? code + "-STRING_22" : code + "-STRING_92",
1437
- description: this.createErrorMessage(isRequestBody ? "BOOL_23" : "BOOL_93", keys)
1436
+ description: this.createErrorMessage(isRequestBody ? "STRING_22" : "STRING_92", keys)
1438
1437
  });
1439
1438
  }
1440
1439
 
@@ -1442,7 +1441,7 @@ export class RequestType extends ReqResType {
1442
1441
  errorList.push({
1443
1442
  status: 400,
1444
1443
  code: isRequestBody ? code + "-STRING_23" : code + "-STRING_93",
1445
- description: this.createErrorMessage(isRequestBody ? "BOOL_23" : "BOOL_93", keys)
1444
+ description: this.createErrorMessage(isRequestBody ? "STRING_23" : "STRING_93", keys)
1446
1445
  });
1447
1446
  }
1448
1447
  break;