pg-mvc-service 2.0.119 → 2.0.121

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,7 +207,12 @@ class RequestType extends ReqResType_1.default {
207
207
  break;
208
208
  }
209
209
  errorMessage = errorMessage.replace("{property}", keys.join('.'));
210
- errorMessage = errorMessage.replace("{value}", value !== null && value !== void 0 ? value : "");
210
+ if (value === undefined || value === '') {
211
+ errorMessage = errorMessage.replace("({value})", value);
212
+ }
213
+ else {
214
+ errorMessage = errorMessage.replace("{value}", value);
215
+ }
211
216
  return errorMessage;
212
217
  }
213
218
  /**
@@ -1017,8 +1022,11 @@ class RequestType extends ReqResType_1.default {
1017
1022
  return ymlString;
1018
1023
  }
1019
1024
  getInputErrorList(method, code) {
1025
+ let isA = false;
1020
1026
  let errorList = [];
1021
1027
  for (const [key, property] of Object.entries(this.properties)) {
1028
+ if (key === 'attendeeList')
1029
+ isA = true;
1022
1030
  if (property.type.endsWith('?') === false) {
1023
1031
  const errorCode = property.type === 'array' && ['GET', 'DELETE'].includes(method) ? 'REQUIRE_00' : 'REQUIRE_01';
1024
1032
  errorList.push({
@@ -1044,9 +1052,10 @@ class RequestType extends ReqResType_1.default {
1044
1052
  code: code + '-ARRAY_01',
1045
1053
  description: this.createErrorMessage('ARRAY_01', [key])
1046
1054
  });
1047
- console.log(property.description, property.type);
1048
1055
  errorList = [...errorList, ...this.getErrorArray([key], code)];
1049
- console.log("errorList", errorList);
1056
+ if (isA) {
1057
+ console.log(errorList);
1058
+ }
1050
1059
  break;
1051
1060
  case 'map':
1052
1061
  case 'map?':
@@ -1089,6 +1098,8 @@ class RequestType extends ReqResType_1.default {
1089
1098
  break;
1090
1099
  }
1091
1100
  }
1101
+ if (isA)
1102
+ console.log("last", errorList);
1092
1103
  return errorList;
1093
1104
  }
1094
1105
  getErrorObject(keys, code) {
@@ -1170,7 +1181,6 @@ class RequestType extends ReqResType_1.default {
1170
1181
  getErrorArray(keys, code) {
1171
1182
  let errorList = [];
1172
1183
  const property = this.getProperty(keys);
1173
- console.log(keys, property);
1174
1184
  if (property.type !== 'array' && property.type !== 'array?') {
1175
1185
  throw new Error(`setArrayメソッドでArray型以外が入力された場合はエラー\n keys: ${keys.join(',')}`);
1176
1186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-mvc-service",
3
- "version": "2.0.119",
3
+ "version": "2.0.121",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
6
6
  "bugs": {
@@ -248,7 +248,12 @@ export class RequestType extends ReqResType {
248
248
  }
249
249
 
250
250
  errorMessage = errorMessage.replace("{property}", keys.join('.'));
251
- errorMessage = errorMessage.replace("{value}", value ?? "");
251
+ if (value === undefined || value === '') {
252
+ errorMessage = errorMessage.replace("({value})", value);
253
+ } else {
254
+ errorMessage = errorMessage.replace("{value}", value);
255
+ }
256
+
252
257
 
253
258
  return errorMessage;
254
259
  }
@@ -1119,8 +1124,10 @@ export class RequestType extends ReqResType {
1119
1124
  }
1120
1125
 
1121
1126
  public getInputErrorList(method: string, code: string): Array<IError> {
1127
+ let isA = false;
1122
1128
  let errorList: Array<IError> = [];
1123
1129
  for (const [key, property] of Object.entries(this.properties)) {
1130
+ if (key === 'attendeeList') isA = true;
1124
1131
  if (property.type.endsWith('?') === false) {
1125
1132
  const errorCode = property.type === 'array' && ['GET', 'DELETE'].includes(method) ? 'REQUIRE_00' : 'REQUIRE_01';
1126
1133
  errorList.push({
@@ -1149,9 +1156,10 @@ export class RequestType extends ReqResType {
1149
1156
  description: this.createErrorMessage('ARRAY_01', [key])
1150
1157
  });
1151
1158
 
1152
- console.log(property.description, property.type)
1153
1159
  errorList = [...errorList, ...this.getErrorArray([key], code)];
1154
- console.log("errorList", errorList)
1160
+ if (isA) {
1161
+ console.log(errorList);
1162
+ }
1155
1163
  break;
1156
1164
  case 'map':
1157
1165
  case 'map?':
@@ -1195,6 +1203,8 @@ export class RequestType extends ReqResType {
1195
1203
  }
1196
1204
  }
1197
1205
 
1206
+ if (isA)
1207
+ console.log("last", errorList);
1198
1208
  return errorList;
1199
1209
  }
1200
1210
 
@@ -1285,7 +1295,6 @@ export class RequestType extends ReqResType {
1285
1295
  let errorList: Array<IError> = [];
1286
1296
 
1287
1297
  const property = this.getProperty(keys);
1288
- console.log(keys, property);
1289
1298
  if (property.type !== 'array' && property.type !== 'array?') {
1290
1299
  throw new Error(`setArrayメソッドでArray型以外が入力された場合はエラー\n keys: ${keys.join(',')}`);
1291
1300
  }