pg-mvc-service 2.0.126 → 2.0.128
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.
- package/dist/documents/Swagger.js +2 -2
- package/dist/reqestResponse/RequestType.js +56 -56
- package/dist/reqestResponse/ResponseType.js +3 -3
- package/package.json +1 -1
- package/src/documents/Swagger.ts +2 -2
- package/src/reqestResponse/RequestType.ts +56 -56
- package/src/reqestResponse/ResponseType.ts +3 -3
|
@@ -59,8 +59,8 @@ const createSwagger = (services, name, url, params = []) => {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
yml += service.Request.createSwagger(service.Method);
|
|
62
|
-
const errorList = [...service.ErrorList, ...service.Request.getInputErrorList(service.Method
|
|
63
|
-
yml += service.Response.createSwagger(errorList);
|
|
62
|
+
const errorList = [...service.ErrorList, ...service.Request.getInputErrorList(service.Method)];
|
|
63
|
+
yml += service.Response.createSwagger(errorList, service.ApiCode);
|
|
64
64
|
endpontSwaggerYml[service.Endpoint][service.Method] = yml;
|
|
65
65
|
}
|
|
66
66
|
let swaggerInfo = `openapi: 3.0.0
|
|
@@ -1021,14 +1021,14 @@ class RequestType extends ReqResType_1.default {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
return ymlString;
|
|
1023
1023
|
}
|
|
1024
|
-
getInputErrorList(method
|
|
1024
|
+
getInputErrorList(method) {
|
|
1025
1025
|
let errorList = [];
|
|
1026
1026
|
for (const [key, property] of Object.entries(this.properties)) {
|
|
1027
1027
|
if (property.type.endsWith('?') === false) {
|
|
1028
1028
|
const errorCode = property.type === 'array' && ['GET', 'DELETE'].includes(method) ? 'REQUIRE_00' : 'REQUIRE_01';
|
|
1029
1029
|
errorList.push({
|
|
1030
1030
|
status: 400,
|
|
1031
|
-
code:
|
|
1031
|
+
code: errorCode,
|
|
1032
1032
|
description: this.createErrorMessage(errorCode, [key])
|
|
1033
1033
|
});
|
|
1034
1034
|
}
|
|
@@ -1037,19 +1037,19 @@ class RequestType extends ReqResType_1.default {
|
|
|
1037
1037
|
case 'object?':
|
|
1038
1038
|
errorList.push({
|
|
1039
1039
|
status: 400,
|
|
1040
|
-
code:
|
|
1040
|
+
code: 'OBJECT_01',
|
|
1041
1041
|
description: this.createErrorMessage('OBJECT_01', [key])
|
|
1042
1042
|
});
|
|
1043
|
-
errorList = [...errorList, ...this.getErrorObject([key]
|
|
1043
|
+
errorList = [...errorList, ...this.getErrorObject([key])];
|
|
1044
1044
|
break;
|
|
1045
1045
|
case 'array':
|
|
1046
1046
|
case 'array?':
|
|
1047
1047
|
errorList.push({
|
|
1048
1048
|
status: 400,
|
|
1049
|
-
code:
|
|
1049
|
+
code: 'ARRAY_01',
|
|
1050
1050
|
description: this.createErrorMessage('ARRAY_01', [key])
|
|
1051
1051
|
});
|
|
1052
|
-
errorList = [...errorList, ...this.getErrorArray([key]
|
|
1052
|
+
errorList = [...errorList, ...this.getErrorArray([key])];
|
|
1053
1053
|
break;
|
|
1054
1054
|
case 'map':
|
|
1055
1055
|
case 'map?':
|
|
@@ -1057,44 +1057,44 @@ class RequestType extends ReqResType_1.default {
|
|
|
1057
1057
|
case 'number':
|
|
1058
1058
|
errorList.push({
|
|
1059
1059
|
status: 400,
|
|
1060
|
-
code:
|
|
1060
|
+
code: 'MAP_01',
|
|
1061
1061
|
description: this.createErrorMessage('MAP_01', [key])
|
|
1062
1062
|
});
|
|
1063
1063
|
break;
|
|
1064
1064
|
case 'string':
|
|
1065
1065
|
errorList.push({
|
|
1066
1066
|
status: 400,
|
|
1067
|
-
code:
|
|
1067
|
+
code: 'MAP_02',
|
|
1068
1068
|
description: this.createErrorMessage('MAP_02', [key])
|
|
1069
1069
|
});
|
|
1070
1070
|
break;
|
|
1071
1071
|
case 'bool':
|
|
1072
1072
|
errorList.push({
|
|
1073
1073
|
status: 400,
|
|
1074
|
-
code:
|
|
1074
|
+
code: 'MAP_03',
|
|
1075
1075
|
description: this.createErrorMessage('MAP_03', [key])
|
|
1076
1076
|
});
|
|
1077
1077
|
errorList.push({
|
|
1078
1078
|
status: 400,
|
|
1079
|
-
code:
|
|
1079
|
+
code: 'MAP_04',
|
|
1080
1080
|
description: this.createErrorMessage('MAP_04', [key])
|
|
1081
1081
|
});
|
|
1082
1082
|
errorList.push({
|
|
1083
1083
|
status: 400,
|
|
1084
|
-
code:
|
|
1084
|
+
code: 'MAP_05',
|
|
1085
1085
|
description: this.createErrorMessage('MAP_05', [key])
|
|
1086
1086
|
});
|
|
1087
1087
|
break;
|
|
1088
1088
|
}
|
|
1089
1089
|
break;
|
|
1090
1090
|
default:
|
|
1091
|
-
errorList = [...errorList, ...this.getError([key],
|
|
1091
|
+
errorList = [...errorList, ...this.getError([key], true)];
|
|
1092
1092
|
break;
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
1095
|
return errorList;
|
|
1096
1096
|
}
|
|
1097
|
-
getErrorObject(keys
|
|
1097
|
+
getErrorObject(keys) {
|
|
1098
1098
|
let errorList = [];
|
|
1099
1099
|
const property = this.getProperty(keys);
|
|
1100
1100
|
if (property.type !== 'object' && property.type !== 'object?') {
|
|
@@ -1104,7 +1104,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
1104
1104
|
if (property.properties[key].type.endsWith('?') === false) {
|
|
1105
1105
|
errorList.push({
|
|
1106
1106
|
status: 400,
|
|
1107
|
-
code:
|
|
1107
|
+
code: 'REQUIRE_11',
|
|
1108
1108
|
description: this.createErrorMessage('REQUIRE_11', [...keys, key]),
|
|
1109
1109
|
});
|
|
1110
1110
|
}
|
|
@@ -1113,19 +1113,19 @@ class RequestType extends ReqResType_1.default {
|
|
|
1113
1113
|
case 'object?':
|
|
1114
1114
|
errorList.push({
|
|
1115
1115
|
status: 400,
|
|
1116
|
-
code:
|
|
1116
|
+
code: 'OBJECT_11',
|
|
1117
1117
|
description: this.createErrorMessage('OBJECT_11', [...keys, key]),
|
|
1118
1118
|
});
|
|
1119
|
-
errorList = [...errorList, ...this.getErrorObject([...keys, key]
|
|
1119
|
+
errorList = [...errorList, ...this.getErrorObject([...keys, key])];
|
|
1120
1120
|
break;
|
|
1121
1121
|
case 'array':
|
|
1122
1122
|
case 'array?':
|
|
1123
1123
|
errorList.push({
|
|
1124
1124
|
status: 400,
|
|
1125
|
-
code:
|
|
1125
|
+
code: 'ARRAY_11',
|
|
1126
1126
|
description: this.createErrorMessage('ARRAY_11', [...keys, key]),
|
|
1127
1127
|
});
|
|
1128
|
-
errorList = [...errorList, ...this.getErrorArray([...keys, key, 0]
|
|
1128
|
+
errorList = [...errorList, ...this.getErrorArray([...keys, key, 0])];
|
|
1129
1129
|
break;
|
|
1130
1130
|
case 'map':
|
|
1131
1131
|
case 'map?':
|
|
@@ -1133,44 +1133,44 @@ class RequestType extends ReqResType_1.default {
|
|
|
1133
1133
|
case 'number':
|
|
1134
1134
|
errorList.push({
|
|
1135
1135
|
status: 400,
|
|
1136
|
-
code:
|
|
1136
|
+
code: 'MAP_11',
|
|
1137
1137
|
description: this.createErrorMessage('MAP_11', [key])
|
|
1138
1138
|
});
|
|
1139
1139
|
break;
|
|
1140
1140
|
case 'string':
|
|
1141
1141
|
errorList.push({
|
|
1142
1142
|
status: 400,
|
|
1143
|
-
code:
|
|
1143
|
+
code: 'MAP_12',
|
|
1144
1144
|
description: this.createErrorMessage('MAP_12', [key])
|
|
1145
1145
|
});
|
|
1146
1146
|
break;
|
|
1147
1147
|
case 'bool':
|
|
1148
1148
|
errorList.push({
|
|
1149
1149
|
status: 400,
|
|
1150
|
-
code:
|
|
1150
|
+
code: 'MAP_13',
|
|
1151
1151
|
description: this.createErrorMessage('MAP_13', [key])
|
|
1152
1152
|
});
|
|
1153
1153
|
errorList.push({
|
|
1154
1154
|
status: 400,
|
|
1155
|
-
code:
|
|
1155
|
+
code: 'MAP_14',
|
|
1156
1156
|
description: this.createErrorMessage('MAP_14', [key])
|
|
1157
1157
|
});
|
|
1158
1158
|
errorList.push({
|
|
1159
1159
|
status: 400,
|
|
1160
|
-
code:
|
|
1160
|
+
code: 'MAP_15',
|
|
1161
1161
|
description: this.createErrorMessage('MAP_15', [key])
|
|
1162
1162
|
});
|
|
1163
1163
|
break;
|
|
1164
1164
|
}
|
|
1165
1165
|
break;
|
|
1166
1166
|
default:
|
|
1167
|
-
errorList = [...errorList, ...this.getError([...keys, key],
|
|
1167
|
+
errorList = [...errorList, ...this.getError([...keys, key], false)];
|
|
1168
1168
|
break;
|
|
1169
1169
|
}
|
|
1170
1170
|
}
|
|
1171
1171
|
return errorList;
|
|
1172
1172
|
}
|
|
1173
|
-
getErrorArray(keys
|
|
1173
|
+
getErrorArray(keys) {
|
|
1174
1174
|
let errorList = [];
|
|
1175
1175
|
const property = this.getProperty(keys);
|
|
1176
1176
|
if (property.type !== 'array' && property.type !== 'array?') {
|
|
@@ -1178,17 +1178,17 @@ class RequestType extends ReqResType_1.default {
|
|
|
1178
1178
|
}
|
|
1179
1179
|
errorList.push({
|
|
1180
1180
|
status: 400,
|
|
1181
|
-
code:
|
|
1181
|
+
code: 'REQUIRE_31',
|
|
1182
1182
|
description: this.createErrorMessage('REQUIRE_31', [...keys]),
|
|
1183
1183
|
});
|
|
1184
1184
|
switch (property.item.type) {
|
|
1185
1185
|
case 'object':
|
|
1186
1186
|
case 'object?':
|
|
1187
|
-
errorList = [...errorList, ...this.getErrorObject([...keys, 0]
|
|
1187
|
+
errorList = [...errorList, ...this.getErrorObject([...keys, 0])];
|
|
1188
1188
|
break;
|
|
1189
1189
|
case 'array':
|
|
1190
1190
|
case 'array?':
|
|
1191
|
-
errorList = [...errorList, ...this.getErrorArray([...keys, 0]
|
|
1191
|
+
errorList = [...errorList, ...this.getErrorArray([...keys, 0])];
|
|
1192
1192
|
break;
|
|
1193
1193
|
case 'map':
|
|
1194
1194
|
case 'map?':
|
|
@@ -1196,43 +1196,43 @@ class RequestType extends ReqResType_1.default {
|
|
|
1196
1196
|
case 'number':
|
|
1197
1197
|
errorList.push({
|
|
1198
1198
|
status: 400,
|
|
1199
|
-
code:
|
|
1199
|
+
code: 'MAP_31',
|
|
1200
1200
|
description: this.createErrorMessage('MAP_31', [...keys, 0])
|
|
1201
1201
|
});
|
|
1202
1202
|
break;
|
|
1203
1203
|
case 'string':
|
|
1204
1204
|
errorList.push({
|
|
1205
1205
|
status: 400,
|
|
1206
|
-
code:
|
|
1206
|
+
code: 'MAP_32',
|
|
1207
1207
|
description: this.createErrorMessage('MAP_32', [...keys, 0])
|
|
1208
1208
|
});
|
|
1209
1209
|
break;
|
|
1210
1210
|
case 'bool':
|
|
1211
1211
|
errorList.push({
|
|
1212
1212
|
status: 400,
|
|
1213
|
-
code:
|
|
1213
|
+
code: 'MAP_33',
|
|
1214
1214
|
description: this.createErrorMessage('MAP_33', [...keys, 0])
|
|
1215
1215
|
});
|
|
1216
1216
|
errorList.push({
|
|
1217
1217
|
status: 400,
|
|
1218
|
-
code:
|
|
1218
|
+
code: 'MAP_34',
|
|
1219
1219
|
description: this.createErrorMessage('MAP_34', [...keys, 0])
|
|
1220
1220
|
});
|
|
1221
1221
|
errorList.push({
|
|
1222
1222
|
status: 400,
|
|
1223
|
-
code:
|
|
1223
|
+
code: 'MAP_35',
|
|
1224
1224
|
description: this.createErrorMessage('MAP_35', [...keys, 0])
|
|
1225
1225
|
});
|
|
1226
1226
|
break;
|
|
1227
1227
|
}
|
|
1228
1228
|
break;
|
|
1229
1229
|
default:
|
|
1230
|
-
errorList = [...errorList, ...this.getError([...keys, 0],
|
|
1230
|
+
errorList = [...errorList, ...this.getError([...keys, 0], false)];
|
|
1231
1231
|
break;
|
|
1232
1232
|
}
|
|
1233
1233
|
return errorList;
|
|
1234
1234
|
}
|
|
1235
|
-
getError(keys,
|
|
1235
|
+
getError(keys, isRequestBody) {
|
|
1236
1236
|
const errorList = [];
|
|
1237
1237
|
const property = this.getProperty(keys);
|
|
1238
1238
|
switch (property.type) {
|
|
@@ -1243,7 +1243,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
1243
1243
|
case 'number?':
|
|
1244
1244
|
errorList.push({
|
|
1245
1245
|
status: 400,
|
|
1246
|
-
code:
|
|
1246
|
+
code: 'NUMBER_41',
|
|
1247
1247
|
description: this.createErrorMessage('NUMBER_41', keys)
|
|
1248
1248
|
});
|
|
1249
1249
|
break;
|
|
@@ -1251,14 +1251,14 @@ class RequestType extends ReqResType_1.default {
|
|
|
1251
1251
|
case 'string?':
|
|
1252
1252
|
errorList.push({
|
|
1253
1253
|
status: 400,
|
|
1254
|
-
code:
|
|
1254
|
+
code: 'STRING_41',
|
|
1255
1255
|
description: this.createErrorMessage('STRING_41', keys)
|
|
1256
1256
|
});
|
|
1257
1257
|
break;
|
|
1258
1258
|
}
|
|
1259
1259
|
errorList.push({
|
|
1260
1260
|
status: 400,
|
|
1261
|
-
code:
|
|
1261
|
+
code: 'ENUM_42',
|
|
1262
1262
|
description: this.createErrorMessage('ENUM_42', keys)
|
|
1263
1263
|
});
|
|
1264
1264
|
break;
|
|
@@ -1266,20 +1266,20 @@ class RequestType extends ReqResType_1.default {
|
|
|
1266
1266
|
case 'number?':
|
|
1267
1267
|
errorList.push({
|
|
1268
1268
|
status: 400,
|
|
1269
|
-
code: isRequestBody ?
|
|
1269
|
+
code: isRequestBody ? "NUMBER_21" : "NUMBER_91",
|
|
1270
1270
|
description: this.createErrorMessage(isRequestBody ? "NUMBER_21" : "NUMBER_91", keys)
|
|
1271
1271
|
});
|
|
1272
1272
|
if (property.min !== undefined) {
|
|
1273
1273
|
errorList.push({
|
|
1274
1274
|
status: 400,
|
|
1275
|
-
code: isRequestBody ?
|
|
1275
|
+
code: isRequestBody ? "NUMBER_22" : "NUMBER_92",
|
|
1276
1276
|
description: this.createErrorMessage(isRequestBody ? "NUMBER_22" : "NUMBER_92", keys)
|
|
1277
1277
|
});
|
|
1278
1278
|
}
|
|
1279
1279
|
if (property.max !== undefined) {
|
|
1280
1280
|
errorList.push({
|
|
1281
1281
|
status: 400,
|
|
1282
|
-
code: isRequestBody ?
|
|
1282
|
+
code: isRequestBody ? "NUMBER_23" : "NUMBER_93",
|
|
1283
1283
|
description: this.createErrorMessage(isRequestBody ? "NUMBER_23" : "NUMBER_93", keys)
|
|
1284
1284
|
});
|
|
1285
1285
|
}
|
|
@@ -1288,17 +1288,17 @@ class RequestType extends ReqResType_1.default {
|
|
|
1288
1288
|
case 'boolean?':
|
|
1289
1289
|
errorList.push({
|
|
1290
1290
|
status: 400,
|
|
1291
|
-
code: isRequestBody ?
|
|
1291
|
+
code: isRequestBody ? "BOOL_21" : "BOOL_91",
|
|
1292
1292
|
description: this.createErrorMessage(isRequestBody ? "BOOL_21" : "BOOL_91", keys)
|
|
1293
1293
|
});
|
|
1294
1294
|
errorList.push({
|
|
1295
1295
|
status: 400,
|
|
1296
|
-
code: isRequestBody ?
|
|
1296
|
+
code: isRequestBody ? "BOOL_22" : "BOOL_92",
|
|
1297
1297
|
description: this.createErrorMessage(isRequestBody ? "BOOL_22" : "BOOL_92", keys)
|
|
1298
1298
|
});
|
|
1299
1299
|
errorList.push({
|
|
1300
1300
|
status: 400,
|
|
1301
|
-
code: isRequestBody ?
|
|
1301
|
+
code: isRequestBody ? "BOOL_23" : "BOOL_93",
|
|
1302
1302
|
description: this.createErrorMessage(isRequestBody ? "BOOL_23" : "BOOL_93", keys)
|
|
1303
1303
|
});
|
|
1304
1304
|
break;
|
|
@@ -1306,20 +1306,20 @@ class RequestType extends ReqResType_1.default {
|
|
|
1306
1306
|
case 'string?':
|
|
1307
1307
|
errorList.push({
|
|
1308
1308
|
status: 400,
|
|
1309
|
-
code: isRequestBody ?
|
|
1309
|
+
code: isRequestBody ? "STRING_21" : "STRING_91",
|
|
1310
1310
|
description: this.createErrorMessage(isRequestBody ? "STRING_21" : "STRING_91", keys)
|
|
1311
1311
|
});
|
|
1312
1312
|
if (property.maxLength !== undefined) {
|
|
1313
1313
|
errorList.push({
|
|
1314
1314
|
status: 400,
|
|
1315
|
-
code: isRequestBody ?
|
|
1315
|
+
code: isRequestBody ? "STRING_22" : "STRING_92",
|
|
1316
1316
|
description: this.createErrorMessage(isRequestBody ? "STRING_22" : "STRING_92", keys)
|
|
1317
1317
|
});
|
|
1318
1318
|
}
|
|
1319
1319
|
if (property.regExp !== undefined) {
|
|
1320
1320
|
errorList.push({
|
|
1321
1321
|
status: 400,
|
|
1322
|
-
code: isRequestBody ?
|
|
1322
|
+
code: isRequestBody ? "STRING_23" : "STRING_93",
|
|
1323
1323
|
description: this.createErrorMessage(isRequestBody ? "STRING_23" : "STRING_93", keys)
|
|
1324
1324
|
});
|
|
1325
1325
|
}
|
|
@@ -1328,7 +1328,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
1328
1328
|
case 'uuid?':
|
|
1329
1329
|
errorList.push({
|
|
1330
1330
|
status: 400,
|
|
1331
|
-
code: isRequestBody ?
|
|
1331
|
+
code: isRequestBody ? "UUID_21" : "UUID_91",
|
|
1332
1332
|
description: this.createErrorMessage(isRequestBody ? "UUID_21" : "UUID_91", keys)
|
|
1333
1333
|
});
|
|
1334
1334
|
break;
|
|
@@ -1336,7 +1336,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
1336
1336
|
case 'mail?':
|
|
1337
1337
|
errorList.push({
|
|
1338
1338
|
status: 400,
|
|
1339
|
-
code: isRequestBody ?
|
|
1339
|
+
code: isRequestBody ? "MAIL_21" : "MAIL_91",
|
|
1340
1340
|
description: this.createErrorMessage(isRequestBody ? "MAIL_21" : "MAIL_91", keys)
|
|
1341
1341
|
});
|
|
1342
1342
|
break;
|
|
@@ -1344,12 +1344,12 @@ class RequestType extends ReqResType_1.default {
|
|
|
1344
1344
|
case 'date?':
|
|
1345
1345
|
errorList.push({
|
|
1346
1346
|
status: 400,
|
|
1347
|
-
code: isRequestBody ?
|
|
1347
|
+
code: isRequestBody ? "DATE_21" : "DATE_91",
|
|
1348
1348
|
description: this.createErrorMessage(isRequestBody ? "DATE_21" : "DATE_91", keys)
|
|
1349
1349
|
});
|
|
1350
1350
|
errorList.push({
|
|
1351
1351
|
status: 400,
|
|
1352
|
-
code: isRequestBody ?
|
|
1352
|
+
code: isRequestBody ? "DATE_22" : "DATE_92",
|
|
1353
1353
|
description: this.createErrorMessage(isRequestBody ? "DATE_22" : "DATE_92", keys)
|
|
1354
1354
|
});
|
|
1355
1355
|
break;
|
|
@@ -1357,7 +1357,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
1357
1357
|
case 'time?':
|
|
1358
1358
|
errorList.push({
|
|
1359
1359
|
status: 400,
|
|
1360
|
-
code: isRequestBody ?
|
|
1360
|
+
code: isRequestBody ? "TIME_21" : "TIME_91",
|
|
1361
1361
|
description: this.createErrorMessage(isRequestBody ? "TIME_21" : "TIME_91", keys)
|
|
1362
1362
|
});
|
|
1363
1363
|
break;
|
|
@@ -1365,12 +1365,12 @@ class RequestType extends ReqResType_1.default {
|
|
|
1365
1365
|
case 'datetime?':
|
|
1366
1366
|
errorList.push({
|
|
1367
1367
|
status: 400,
|
|
1368
|
-
code: isRequestBody ?
|
|
1368
|
+
code: isRequestBody ? "DATETIME_21" : "DATETIME_91",
|
|
1369
1369
|
description: this.createErrorMessage(isRequestBody ? "DATETIME_21" : "DATETIME_91", keys)
|
|
1370
1370
|
});
|
|
1371
1371
|
errorList.push({
|
|
1372
1372
|
status: 400,
|
|
1373
|
-
code: isRequestBody ?
|
|
1373
|
+
code: isRequestBody ? "DATETIME_22" : "DATETIME_92",
|
|
1374
1374
|
description: this.createErrorMessage(isRequestBody ? "DATETIME_22" : "DATETIME_92", keys)
|
|
1375
1375
|
});
|
|
1376
1376
|
break;
|
|
@@ -1378,7 +1378,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
1378
1378
|
case 'https?':
|
|
1379
1379
|
errorList.push({
|
|
1380
1380
|
status: 400,
|
|
1381
|
-
code: isRequestBody ?
|
|
1381
|
+
code: isRequestBody ? "HTTPS_21" : "HTTPS_91",
|
|
1382
1382
|
description: this.createErrorMessage(isRequestBody ? "HTTPS_21" : "HTTPS_91", keys)
|
|
1383
1383
|
});
|
|
1384
1384
|
break;
|
|
@@ -1386,7 +1386,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
1386
1386
|
case 'base64?':
|
|
1387
1387
|
errorList.push({
|
|
1388
1388
|
status: 400,
|
|
1389
|
-
code: isRequestBody ?
|
|
1389
|
+
code: isRequestBody ? "BASE64_21" : "BASE64_91",
|
|
1390
1390
|
description: this.createErrorMessage(isRequestBody ? "BASE64_21" : "BASE64_91", keys)
|
|
1391
1391
|
});
|
|
1392
1392
|
break;
|
|
@@ -337,7 +337,7 @@ class ResponseType extends ReqResType_1.default {
|
|
|
337
337
|
* @returns {string} Swagger format response definition
|
|
338
338
|
* Swagger形式のレスポンス定義
|
|
339
339
|
*/
|
|
340
|
-
createSwagger(errorList) {
|
|
340
|
+
createSwagger(errorList, apiCode) {
|
|
341
341
|
let ymlString = ` responses:
|
|
342
342
|
'200':
|
|
343
343
|
description: 成功事レスポンス
|
|
@@ -395,12 +395,12 @@ class ResponseType extends ReqResType_1.default {
|
|
|
395
395
|
if (list.length === 1) {
|
|
396
396
|
// 単一エラーは1行説明
|
|
397
397
|
ymlString += ` '${status}':
|
|
398
|
-
description: ${list[0].description}${list[0].code !== '' ? `
|
|
398
|
+
description: ${list[0].description}${list[0].code !== '' ? ` > ${apiCode}-${list[0].code}` : ''}
|
|
399
399
|
`;
|
|
400
400
|
}
|
|
401
401
|
else {
|
|
402
402
|
// 複数エラーは箇条書き
|
|
403
|
-
const bullets = list.map(e => `- ${e.description}${e.code !== '' ? `
|
|
403
|
+
const bullets = list.map(e => `- ${e.description}${e.code !== '' ? ` > ${apiCode}-${e.code}` : ''}`).join(descIndentJoin);
|
|
404
404
|
ymlString += ` '${status}':
|
|
405
405
|
description: |${descIndentJoin}${bullets}
|
|
406
406
|
`;
|
package/package.json
CHANGED
package/src/documents/Swagger.ts
CHANGED
|
@@ -72,8 +72,8 @@ export const createSwagger = (services: Service[], name: string, url: string, pa
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
yml += service.Request.createSwagger(service.Method);
|
|
75
|
-
const errorList = [...service.ErrorList, ...service.Request.getInputErrorList(service.Method
|
|
76
|
-
yml += service.Response.createSwagger(errorList);
|
|
75
|
+
const errorList = [...service.ErrorList, ...service.Request.getInputErrorList(service.Method)]
|
|
76
|
+
yml += service.Response.createSwagger(errorList, service.ApiCode);
|
|
77
77
|
|
|
78
78
|
endpontSwaggerYml[service.Endpoint][service.Method] = yml;
|
|
79
79
|
}
|
|
@@ -1123,7 +1123,7 @@ export class RequestType extends ReqResType {
|
|
|
1123
1123
|
return ymlString;
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
1126
|
-
public getInputErrorList(method: string
|
|
1126
|
+
public getInputErrorList(method: string): Array<IError> {
|
|
1127
1127
|
let errorList: Array<IError> = [];
|
|
1128
1128
|
|
|
1129
1129
|
for (const [key, property] of Object.entries(this.properties)) {
|
|
@@ -1131,7 +1131,7 @@ export class RequestType extends ReqResType {
|
|
|
1131
1131
|
const errorCode = property.type === 'array' && ['GET', 'DELETE'].includes(method) ? 'REQUIRE_00' : 'REQUIRE_01';
|
|
1132
1132
|
errorList.push({
|
|
1133
1133
|
status: 400,
|
|
1134
|
-
code:
|
|
1134
|
+
code: errorCode,
|
|
1135
1135
|
description: this.createErrorMessage(errorCode, [key])
|
|
1136
1136
|
});
|
|
1137
1137
|
}
|
|
@@ -1141,21 +1141,21 @@ export class RequestType extends ReqResType {
|
|
|
1141
1141
|
case 'object?':
|
|
1142
1142
|
errorList.push({
|
|
1143
1143
|
status: 400,
|
|
1144
|
-
code:
|
|
1144
|
+
code: 'OBJECT_01',
|
|
1145
1145
|
description: this.createErrorMessage('OBJECT_01', [key])
|
|
1146
1146
|
});
|
|
1147
1147
|
|
|
1148
|
-
errorList = [...errorList, ...this.getErrorObject([key]
|
|
1148
|
+
errorList = [...errorList, ...this.getErrorObject([key])];
|
|
1149
1149
|
break;
|
|
1150
1150
|
case 'array':
|
|
1151
1151
|
case 'array?':
|
|
1152
1152
|
errorList.push({
|
|
1153
1153
|
status: 400,
|
|
1154
|
-
code:
|
|
1154
|
+
code: 'ARRAY_01',
|
|
1155
1155
|
description: this.createErrorMessage('ARRAY_01', [key])
|
|
1156
1156
|
});
|
|
1157
1157
|
|
|
1158
|
-
errorList = [...errorList, ...this.getErrorArray([key]
|
|
1158
|
+
errorList = [...errorList, ...this.getErrorArray([key])];
|
|
1159
1159
|
break;
|
|
1160
1160
|
case 'map':
|
|
1161
1161
|
case 'map?':
|
|
@@ -1163,38 +1163,38 @@ export class RequestType extends ReqResType {
|
|
|
1163
1163
|
case 'number':
|
|
1164
1164
|
errorList.push({
|
|
1165
1165
|
status: 400,
|
|
1166
|
-
code:
|
|
1166
|
+
code: 'MAP_01',
|
|
1167
1167
|
description: this.createErrorMessage('MAP_01', [key])
|
|
1168
1168
|
});
|
|
1169
1169
|
break;
|
|
1170
1170
|
case 'string':
|
|
1171
1171
|
errorList.push({
|
|
1172
1172
|
status: 400,
|
|
1173
|
-
code:
|
|
1173
|
+
code: 'MAP_02',
|
|
1174
1174
|
description: this.createErrorMessage('MAP_02', [key])
|
|
1175
1175
|
});
|
|
1176
1176
|
break;
|
|
1177
1177
|
case 'bool':
|
|
1178
1178
|
errorList.push({
|
|
1179
1179
|
status: 400,
|
|
1180
|
-
code:
|
|
1180
|
+
code: 'MAP_03',
|
|
1181
1181
|
description: this.createErrorMessage('MAP_03', [key])
|
|
1182
1182
|
});
|
|
1183
1183
|
errorList.push({
|
|
1184
1184
|
status: 400,
|
|
1185
|
-
code:
|
|
1185
|
+
code: 'MAP_04',
|
|
1186
1186
|
description: this.createErrorMessage('MAP_04', [key])
|
|
1187
1187
|
});
|
|
1188
1188
|
errorList.push({
|
|
1189
1189
|
status: 400,
|
|
1190
|
-
code:
|
|
1190
|
+
code: 'MAP_05',
|
|
1191
1191
|
description: this.createErrorMessage('MAP_05', [key])
|
|
1192
1192
|
});
|
|
1193
1193
|
break;
|
|
1194
1194
|
}
|
|
1195
1195
|
break;
|
|
1196
1196
|
default:
|
|
1197
|
-
errorList = [...errorList, ...this.getError([key],
|
|
1197
|
+
errorList = [...errorList, ...this.getError([key], true)];
|
|
1198
1198
|
break;
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
@@ -1202,7 +1202,7 @@ export class RequestType extends ReqResType {
|
|
|
1202
1202
|
return errorList;
|
|
1203
1203
|
}
|
|
1204
1204
|
|
|
1205
|
-
private getErrorObject(keys: Array<string | number
|
|
1205
|
+
private getErrorObject(keys: Array<string | number>): Array<IError> {
|
|
1206
1206
|
let errorList: Array<IError> = [];
|
|
1207
1207
|
|
|
1208
1208
|
const property = this.getProperty(keys);
|
|
@@ -1214,7 +1214,7 @@ export class RequestType extends ReqResType {
|
|
|
1214
1214
|
if (property.properties[key].type.endsWith('?') === false) {
|
|
1215
1215
|
errorList.push({
|
|
1216
1216
|
status: 400,
|
|
1217
|
-
code:
|
|
1217
|
+
code: 'REQUIRE_11',
|
|
1218
1218
|
description: this.createErrorMessage('REQUIRE_11', [...keys, key]),
|
|
1219
1219
|
});
|
|
1220
1220
|
}
|
|
@@ -1224,21 +1224,21 @@ export class RequestType extends ReqResType {
|
|
|
1224
1224
|
case 'object?':
|
|
1225
1225
|
errorList.push({
|
|
1226
1226
|
status: 400,
|
|
1227
|
-
code:
|
|
1227
|
+
code: 'OBJECT_11',
|
|
1228
1228
|
description: this.createErrorMessage('OBJECT_11', [...keys, key]),
|
|
1229
1229
|
});
|
|
1230
1230
|
|
|
1231
|
-
errorList = [...errorList, ...this.getErrorObject([...keys, key]
|
|
1231
|
+
errorList = [...errorList, ...this.getErrorObject([...keys, key])];
|
|
1232
1232
|
break;
|
|
1233
1233
|
case 'array':
|
|
1234
1234
|
case 'array?':
|
|
1235
1235
|
errorList.push({
|
|
1236
1236
|
status: 400,
|
|
1237
|
-
code:
|
|
1237
|
+
code: 'ARRAY_11',
|
|
1238
1238
|
description: this.createErrorMessage('ARRAY_11', [...keys, key]),
|
|
1239
1239
|
});
|
|
1240
1240
|
|
|
1241
|
-
errorList = [...errorList, ...this.getErrorArray([...keys, key, 0]
|
|
1241
|
+
errorList = [...errorList, ...this.getErrorArray([...keys, key, 0])];
|
|
1242
1242
|
break;
|
|
1243
1243
|
case 'map':
|
|
1244
1244
|
case 'map?':
|
|
@@ -1246,38 +1246,38 @@ export class RequestType extends ReqResType {
|
|
|
1246
1246
|
case 'number':
|
|
1247
1247
|
errorList.push({
|
|
1248
1248
|
status: 400,
|
|
1249
|
-
code:
|
|
1249
|
+
code: 'MAP_11',
|
|
1250
1250
|
description: this.createErrorMessage('MAP_11', [key])
|
|
1251
1251
|
});
|
|
1252
1252
|
break;
|
|
1253
1253
|
case 'string':
|
|
1254
1254
|
errorList.push({
|
|
1255
1255
|
status: 400,
|
|
1256
|
-
code:
|
|
1256
|
+
code: 'MAP_12',
|
|
1257
1257
|
description: this.createErrorMessage('MAP_12', [key])
|
|
1258
1258
|
});
|
|
1259
1259
|
break;
|
|
1260
1260
|
case 'bool':
|
|
1261
1261
|
errorList.push({
|
|
1262
1262
|
status: 400,
|
|
1263
|
-
code:
|
|
1263
|
+
code: 'MAP_13',
|
|
1264
1264
|
description: this.createErrorMessage('MAP_13', [key])
|
|
1265
1265
|
});
|
|
1266
1266
|
errorList.push({
|
|
1267
1267
|
status: 400,
|
|
1268
|
-
code:
|
|
1268
|
+
code: 'MAP_14',
|
|
1269
1269
|
description: this.createErrorMessage('MAP_14', [key])
|
|
1270
1270
|
});
|
|
1271
1271
|
errorList.push({
|
|
1272
1272
|
status: 400,
|
|
1273
|
-
code:
|
|
1273
|
+
code: 'MAP_15',
|
|
1274
1274
|
description: this.createErrorMessage('MAP_15', [key])
|
|
1275
1275
|
});
|
|
1276
1276
|
break;
|
|
1277
1277
|
}
|
|
1278
1278
|
break;
|
|
1279
1279
|
default:
|
|
1280
|
-
errorList = [...errorList, ...this.getError([...keys, key],
|
|
1280
|
+
errorList = [...errorList, ...this.getError([...keys, key], false)];
|
|
1281
1281
|
break;
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
@@ -1285,7 +1285,7 @@ export class RequestType extends ReqResType {
|
|
|
1285
1285
|
return errorList;
|
|
1286
1286
|
}
|
|
1287
1287
|
|
|
1288
|
-
private getErrorArray(keys: Array<string | number
|
|
1288
|
+
private getErrorArray(keys: Array<string | number>) {
|
|
1289
1289
|
let errorList: Array<IError> = [];
|
|
1290
1290
|
|
|
1291
1291
|
const property = this.getProperty(keys);
|
|
@@ -1295,18 +1295,18 @@ export class RequestType extends ReqResType {
|
|
|
1295
1295
|
|
|
1296
1296
|
errorList.push({
|
|
1297
1297
|
status: 400,
|
|
1298
|
-
code:
|
|
1298
|
+
code: 'REQUIRE_31',
|
|
1299
1299
|
description: this.createErrorMessage('REQUIRE_31', [...keys]),
|
|
1300
1300
|
});
|
|
1301
1301
|
|
|
1302
1302
|
switch (property.item.type) {
|
|
1303
1303
|
case 'object':
|
|
1304
1304
|
case 'object?':
|
|
1305
|
-
errorList = [...errorList, ...this.getErrorObject([...keys, 0]
|
|
1305
|
+
errorList = [...errorList, ...this.getErrorObject([...keys, 0])];
|
|
1306
1306
|
break;
|
|
1307
1307
|
case 'array':
|
|
1308
1308
|
case 'array?':
|
|
1309
|
-
errorList = [...errorList, ...this.getErrorArray([...keys, 0]
|
|
1309
|
+
errorList = [...errorList, ...this.getErrorArray([...keys, 0])];
|
|
1310
1310
|
break;
|
|
1311
1311
|
case 'map':
|
|
1312
1312
|
case 'map?':
|
|
@@ -1314,45 +1314,45 @@ export class RequestType extends ReqResType {
|
|
|
1314
1314
|
case 'number':
|
|
1315
1315
|
errorList.push({
|
|
1316
1316
|
status: 400,
|
|
1317
|
-
code:
|
|
1317
|
+
code: 'MAP_31',
|
|
1318
1318
|
description: this.createErrorMessage('MAP_31', [...keys, 0])
|
|
1319
1319
|
});
|
|
1320
1320
|
break;
|
|
1321
1321
|
case 'string':
|
|
1322
1322
|
errorList.push({
|
|
1323
1323
|
status: 400,
|
|
1324
|
-
code:
|
|
1324
|
+
code: 'MAP_32',
|
|
1325
1325
|
description: this.createErrorMessage('MAP_32', [...keys, 0])
|
|
1326
1326
|
});
|
|
1327
1327
|
break;
|
|
1328
1328
|
case 'bool':
|
|
1329
1329
|
errorList.push({
|
|
1330
1330
|
status: 400,
|
|
1331
|
-
code:
|
|
1331
|
+
code: 'MAP_33',
|
|
1332
1332
|
description: this.createErrorMessage('MAP_33', [...keys, 0])
|
|
1333
1333
|
});
|
|
1334
1334
|
errorList.push({
|
|
1335
1335
|
status: 400,
|
|
1336
|
-
code:
|
|
1336
|
+
code: 'MAP_34',
|
|
1337
1337
|
description: this.createErrorMessage('MAP_34', [...keys, 0])
|
|
1338
1338
|
});
|
|
1339
1339
|
errorList.push({
|
|
1340
1340
|
status: 400,
|
|
1341
|
-
code:
|
|
1341
|
+
code: 'MAP_35',
|
|
1342
1342
|
description: this.createErrorMessage('MAP_35', [...keys, 0])
|
|
1343
1343
|
});
|
|
1344
1344
|
break;
|
|
1345
1345
|
}
|
|
1346
1346
|
break;
|
|
1347
1347
|
default:
|
|
1348
|
-
errorList = [...errorList, ...this.getError([...keys, 0],
|
|
1348
|
+
errorList = [...errorList, ...this.getError([...keys, 0], false)];
|
|
1349
1349
|
break;
|
|
1350
1350
|
}
|
|
1351
1351
|
|
|
1352
1352
|
return errorList;
|
|
1353
1353
|
}
|
|
1354
1354
|
|
|
1355
|
-
private getError(keys: Array<string | number>,
|
|
1355
|
+
private getError(keys: Array<string | number>, isRequestBody: boolean): Array<IError> {
|
|
1356
1356
|
const errorList: Array<IError> = [];
|
|
1357
1357
|
const property = this.getProperty(keys);
|
|
1358
1358
|
switch (property.type) {
|
|
@@ -1363,7 +1363,7 @@ export class RequestType extends ReqResType {
|
|
|
1363
1363
|
case 'number?':
|
|
1364
1364
|
errorList.push({
|
|
1365
1365
|
status: 400,
|
|
1366
|
-
code:
|
|
1366
|
+
code: 'NUMBER_41',
|
|
1367
1367
|
description: this.createErrorMessage('NUMBER_41', keys)
|
|
1368
1368
|
});
|
|
1369
1369
|
break;
|
|
@@ -1371,14 +1371,14 @@ export class RequestType extends ReqResType {
|
|
|
1371
1371
|
case 'string?':
|
|
1372
1372
|
errorList.push({
|
|
1373
1373
|
status: 400,
|
|
1374
|
-
code:
|
|
1374
|
+
code: 'STRING_41',
|
|
1375
1375
|
description: this.createErrorMessage('STRING_41', keys)
|
|
1376
1376
|
});
|
|
1377
1377
|
break;
|
|
1378
1378
|
}
|
|
1379
1379
|
errorList.push({
|
|
1380
1380
|
status: 400,
|
|
1381
|
-
code:
|
|
1381
|
+
code: 'ENUM_42',
|
|
1382
1382
|
description: this.createErrorMessage('ENUM_42', keys)
|
|
1383
1383
|
});
|
|
1384
1384
|
break;
|
|
@@ -1386,14 +1386,14 @@ export class RequestType extends ReqResType {
|
|
|
1386
1386
|
case 'number?':
|
|
1387
1387
|
errorList.push({
|
|
1388
1388
|
status: 400,
|
|
1389
|
-
code: isRequestBody ?
|
|
1389
|
+
code: isRequestBody ? "NUMBER_21" : "NUMBER_91",
|
|
1390
1390
|
description: this.createErrorMessage(isRequestBody ? "NUMBER_21" : "NUMBER_91", keys)
|
|
1391
1391
|
});
|
|
1392
1392
|
|
|
1393
1393
|
if (property.min !== undefined) {
|
|
1394
1394
|
errorList.push({
|
|
1395
1395
|
status: 400,
|
|
1396
|
-
code: isRequestBody ?
|
|
1396
|
+
code: isRequestBody ? "NUMBER_22" : "NUMBER_92",
|
|
1397
1397
|
description: this.createErrorMessage(isRequestBody ? "NUMBER_22" : "NUMBER_92", keys)
|
|
1398
1398
|
});
|
|
1399
1399
|
}
|
|
@@ -1401,7 +1401,7 @@ export class RequestType extends ReqResType {
|
|
|
1401
1401
|
if (property.max !== undefined) {
|
|
1402
1402
|
errorList.push({
|
|
1403
1403
|
status: 400,
|
|
1404
|
-
code: isRequestBody ?
|
|
1404
|
+
code: isRequestBody ? "NUMBER_23" : "NUMBER_93",
|
|
1405
1405
|
description: this.createErrorMessage(isRequestBody ? "NUMBER_23" : "NUMBER_93", keys)
|
|
1406
1406
|
});
|
|
1407
1407
|
}
|
|
@@ -1410,17 +1410,17 @@ export class RequestType extends ReqResType {
|
|
|
1410
1410
|
case 'boolean?':
|
|
1411
1411
|
errorList.push({
|
|
1412
1412
|
status: 400,
|
|
1413
|
-
code: isRequestBody ?
|
|
1413
|
+
code: isRequestBody ? "BOOL_21" : "BOOL_91",
|
|
1414
1414
|
description: this.createErrorMessage(isRequestBody ? "BOOL_21" : "BOOL_91", keys)
|
|
1415
1415
|
});
|
|
1416
1416
|
errorList.push({
|
|
1417
1417
|
status: 400,
|
|
1418
|
-
code: isRequestBody ?
|
|
1418
|
+
code: isRequestBody ? "BOOL_22" : "BOOL_92",
|
|
1419
1419
|
description: this.createErrorMessage(isRequestBody ? "BOOL_22" : "BOOL_92", keys)
|
|
1420
1420
|
});
|
|
1421
1421
|
errorList.push({
|
|
1422
1422
|
status: 400,
|
|
1423
|
-
code: isRequestBody ?
|
|
1423
|
+
code: isRequestBody ? "BOOL_23" : "BOOL_93",
|
|
1424
1424
|
description: this.createErrorMessage(isRequestBody ? "BOOL_23" : "BOOL_93", keys)
|
|
1425
1425
|
});
|
|
1426
1426
|
break;
|
|
@@ -1428,14 +1428,14 @@ export class RequestType extends ReqResType {
|
|
|
1428
1428
|
case 'string?':
|
|
1429
1429
|
errorList.push({
|
|
1430
1430
|
status: 400,
|
|
1431
|
-
code: isRequestBody ?
|
|
1431
|
+
code: isRequestBody ? "STRING_21" : "STRING_91",
|
|
1432
1432
|
description: this.createErrorMessage(isRequestBody ? "STRING_21" : "STRING_91", keys)
|
|
1433
1433
|
});
|
|
1434
1434
|
|
|
1435
1435
|
if (property.maxLength !== undefined) {
|
|
1436
1436
|
errorList.push({
|
|
1437
1437
|
status: 400,
|
|
1438
|
-
code: isRequestBody ?
|
|
1438
|
+
code: isRequestBody ? "STRING_22" : "STRING_92",
|
|
1439
1439
|
description: this.createErrorMessage(isRequestBody ? "STRING_22" : "STRING_92", keys)
|
|
1440
1440
|
});
|
|
1441
1441
|
}
|
|
@@ -1443,7 +1443,7 @@ export class RequestType extends ReqResType {
|
|
|
1443
1443
|
if (property.regExp !== undefined) {
|
|
1444
1444
|
errorList.push({
|
|
1445
1445
|
status: 400,
|
|
1446
|
-
code: isRequestBody ?
|
|
1446
|
+
code: isRequestBody ? "STRING_23" : "STRING_93",
|
|
1447
1447
|
description: this.createErrorMessage(isRequestBody ? "STRING_23" : "STRING_93", keys)
|
|
1448
1448
|
});
|
|
1449
1449
|
}
|
|
@@ -1452,7 +1452,7 @@ export class RequestType extends ReqResType {
|
|
|
1452
1452
|
case 'uuid?':
|
|
1453
1453
|
errorList.push({
|
|
1454
1454
|
status: 400,
|
|
1455
|
-
code: isRequestBody ?
|
|
1455
|
+
code: isRequestBody ? "UUID_21" : "UUID_91",
|
|
1456
1456
|
description: this.createErrorMessage(isRequestBody ? "UUID_21" : "UUID_91", keys)
|
|
1457
1457
|
});
|
|
1458
1458
|
break;
|
|
@@ -1460,7 +1460,7 @@ export class RequestType extends ReqResType {
|
|
|
1460
1460
|
case 'mail?':
|
|
1461
1461
|
errorList.push({
|
|
1462
1462
|
status: 400,
|
|
1463
|
-
code: isRequestBody ?
|
|
1463
|
+
code: isRequestBody ? "MAIL_21" : "MAIL_91",
|
|
1464
1464
|
description: this.createErrorMessage(isRequestBody ? "MAIL_21" : "MAIL_91", keys)
|
|
1465
1465
|
});
|
|
1466
1466
|
break;
|
|
@@ -1468,12 +1468,12 @@ export class RequestType extends ReqResType {
|
|
|
1468
1468
|
case 'date?':
|
|
1469
1469
|
errorList.push({
|
|
1470
1470
|
status: 400,
|
|
1471
|
-
code: isRequestBody ?
|
|
1471
|
+
code: isRequestBody ? "DATE_21" : "DATE_91",
|
|
1472
1472
|
description: this.createErrorMessage(isRequestBody ? "DATE_21" : "DATE_91", keys)
|
|
1473
1473
|
});
|
|
1474
1474
|
errorList.push({
|
|
1475
1475
|
status: 400,
|
|
1476
|
-
code: isRequestBody ?
|
|
1476
|
+
code: isRequestBody ? "DATE_22" : "DATE_92",
|
|
1477
1477
|
description: this.createErrorMessage(isRequestBody ? "DATE_22" : "DATE_92", keys)
|
|
1478
1478
|
});
|
|
1479
1479
|
break;
|
|
@@ -1481,7 +1481,7 @@ export class RequestType extends ReqResType {
|
|
|
1481
1481
|
case 'time?':
|
|
1482
1482
|
errorList.push({
|
|
1483
1483
|
status: 400,
|
|
1484
|
-
code: isRequestBody ?
|
|
1484
|
+
code: isRequestBody ? "TIME_21" : "TIME_91",
|
|
1485
1485
|
description: this.createErrorMessage(isRequestBody ? "TIME_21" : "TIME_91", keys)
|
|
1486
1486
|
});
|
|
1487
1487
|
break;
|
|
@@ -1489,12 +1489,12 @@ export class RequestType extends ReqResType {
|
|
|
1489
1489
|
case 'datetime?':
|
|
1490
1490
|
errorList.push({
|
|
1491
1491
|
status: 400,
|
|
1492
|
-
code: isRequestBody ?
|
|
1492
|
+
code: isRequestBody ? "DATETIME_21" : "DATETIME_91",
|
|
1493
1493
|
description: this.createErrorMessage(isRequestBody ? "DATETIME_21" : "DATETIME_91", keys)
|
|
1494
1494
|
});
|
|
1495
1495
|
errorList.push({
|
|
1496
1496
|
status: 400,
|
|
1497
|
-
code: isRequestBody ?
|
|
1497
|
+
code: isRequestBody ? "DATETIME_22" : "DATETIME_92",
|
|
1498
1498
|
description: this.createErrorMessage(isRequestBody ? "DATETIME_22" : "DATETIME_92", keys)
|
|
1499
1499
|
});
|
|
1500
1500
|
break;
|
|
@@ -1502,7 +1502,7 @@ export class RequestType extends ReqResType {
|
|
|
1502
1502
|
case 'https?':
|
|
1503
1503
|
errorList.push({
|
|
1504
1504
|
status: 400,
|
|
1505
|
-
code: isRequestBody ?
|
|
1505
|
+
code: isRequestBody ? "HTTPS_21" : "HTTPS_91",
|
|
1506
1506
|
description: this.createErrorMessage(isRequestBody ? "HTTPS_21" : "HTTPS_91", keys)
|
|
1507
1507
|
});
|
|
1508
1508
|
break;
|
|
@@ -1510,7 +1510,7 @@ export class RequestType extends ReqResType {
|
|
|
1510
1510
|
case 'base64?':
|
|
1511
1511
|
errorList.push({
|
|
1512
1512
|
status: 400,
|
|
1513
|
-
code: isRequestBody ?
|
|
1513
|
+
code: isRequestBody ? "BASE64_21" : "BASE64_91",
|
|
1514
1514
|
description: this.createErrorMessage(isRequestBody ? "BASE64_21" : "BASE64_91", keys)
|
|
1515
1515
|
});
|
|
1516
1516
|
break;
|
|
@@ -370,7 +370,7 @@ export class ResponseType extends ReqResType {
|
|
|
370
370
|
* @returns {string} Swagger format response definition
|
|
371
371
|
* Swagger形式のレスポンス定義
|
|
372
372
|
*/
|
|
373
|
-
public createSwagger(errorList: Array<IError
|
|
373
|
+
public createSwagger(errorList: Array<IError>, apiCode: string): string {
|
|
374
374
|
let ymlString = ` responses:
|
|
375
375
|
'200':
|
|
376
376
|
description: 成功事レスポンス
|
|
@@ -433,11 +433,11 @@ export class ResponseType extends ReqResType {
|
|
|
433
433
|
if (list.length === 1) {
|
|
434
434
|
// 単一エラーは1行説明
|
|
435
435
|
ymlString += ` '${status}':
|
|
436
|
-
description: ${list[0].description}${list[0].code !== '' ? `
|
|
436
|
+
description: ${list[0].description}${list[0].code !== '' ? ` > ${apiCode}-${list[0].code}` : ''}
|
|
437
437
|
`;
|
|
438
438
|
} else {
|
|
439
439
|
// 複数エラーは箇条書き
|
|
440
|
-
const bullets = list.map(e => `- ${e.description}${e.code !== '' ? `
|
|
440
|
+
const bullets = list.map(e => `- ${e.description}${e.code !== '' ? ` > ${apiCode}-${e.code}` : ''}`).join(descIndentJoin);
|
|
441
441
|
ymlString += ` '${status}':
|
|
442
442
|
description: |${descIndentJoin}${bullets}
|
|
443
443
|
`;
|