pg-mvc-service 2.0.58 → 2.0.60
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/reqestResponse/ReqResType.js +12 -3
- package/dist/reqestResponse/RequestType.js +9 -9
- package/dist/reqestResponse/ResponseType.js +5 -5
- package/package.json +1 -1
- package/src/reqestResponse/ReqResType.ts +13 -4
- package/src/reqestResponse/RequestType.ts +9 -9
- package/src/reqestResponse/ResponseType.ts +5 -5
|
@@ -44,7 +44,7 @@ class ReqResType {
|
|
|
44
44
|
const key = keys[i];
|
|
45
45
|
if (typeof key === 'number') {
|
|
46
46
|
if (property.type === 'array' || property.type === 'array?') {
|
|
47
|
-
property = property.
|
|
47
|
+
property = property.item;
|
|
48
48
|
continue;
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
@@ -57,17 +57,26 @@ class ReqResType {
|
|
|
57
57
|
if (typeof key !== 'number') {
|
|
58
58
|
throw new Error(`getPropertyでnumber型のINPUTで、array以外の場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
59
59
|
}
|
|
60
|
-
property = property.
|
|
60
|
+
property = property.item;
|
|
61
61
|
continue;
|
|
62
62
|
case 'object':
|
|
63
|
-
case 'object':
|
|
63
|
+
case 'object?':
|
|
64
64
|
if (typeof key !== 'string') {
|
|
65
65
|
throw new Error(`getPropertyでnumber型のINPUTで、arrayの場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
66
66
|
}
|
|
67
67
|
property = property.properties[key];
|
|
68
68
|
continue;
|
|
69
|
+
// case 'dictionary':
|
|
70
|
+
// case 'dictionary?':
|
|
71
|
+
// if (typeof key !== 'string') {
|
|
72
|
+
// throw new Error(`getPropertyでnumber型のINPUTで、arrayの場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
73
|
+
// }
|
|
74
|
+
// property = property.properties[key];
|
|
75
|
+
// continue;
|
|
69
76
|
default:
|
|
70
77
|
throw new Error(`getPropertyでarray,object以外のtypeを読み込もうとしている。\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
78
|
+
// property = property[key];
|
|
79
|
+
// continue;
|
|
71
80
|
}
|
|
72
81
|
}
|
|
73
82
|
return property;
|
|
@@ -222,7 +222,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
222
222
|
// GET,DELETEメソッドの場合、?array=1&array=2で配列となるが、
|
|
223
223
|
// ?array=1のみで終わる場合は配列にならないため、直接配列にしている
|
|
224
224
|
// この処理で空文字やnullが入った場合の対処をここで行う
|
|
225
|
-
const itemProperty = this.properties[key].
|
|
225
|
+
const itemProperty = this.properties[key].item;
|
|
226
226
|
if (itemProperty.type.endsWith('?')) {
|
|
227
227
|
const tempValue = this.data[key];
|
|
228
228
|
this.data[key] = [];
|
|
@@ -270,7 +270,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
270
270
|
if (request.method === 'GET' || request.method === 'DELETE') {
|
|
271
271
|
// GET,DELETEメソッドの場合、?array=1&array=2で配列となるが、
|
|
272
272
|
// ?array=1のみで終わる場合は配列にならないため、直接配列にしている
|
|
273
|
-
this.data[key] = [this.convertValue(this.properties[key].
|
|
273
|
+
this.data[key] = [this.convertValue(this.properties[key].item.type, value, [key, 0], true)];
|
|
274
274
|
}
|
|
275
275
|
else {
|
|
276
276
|
this.throwInputError("ARRAY_01", [key], value);
|
|
@@ -367,8 +367,8 @@ class RequestType extends ReqResType_1.default {
|
|
|
367
367
|
}
|
|
368
368
|
for (let i = 0; i < values.length; i++) {
|
|
369
369
|
// NULL Check
|
|
370
|
-
if (values[i] === undefined || values[i] === null || (property.
|
|
371
|
-
if (property.
|
|
370
|
+
if (values[i] === undefined || values[i] === null || (property.item.type.replace("?", "") !== "string" && values[i] === "")) {
|
|
371
|
+
if (property.item.type.endsWith('?')) {
|
|
372
372
|
this.changeBody([...keys, i], values[i] === undefined ? undefined : null);
|
|
373
373
|
continue;
|
|
374
374
|
}
|
|
@@ -376,7 +376,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
376
376
|
this.throwInputError("REQUIRE_31", [...keys, i], "");
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
switch (property.
|
|
379
|
+
switch (property.item.type) {
|
|
380
380
|
case 'object':
|
|
381
381
|
case 'object?':
|
|
382
382
|
this.setObject([...keys, i], values[i]);
|
|
@@ -808,12 +808,12 @@ class RequestType extends ReqResType_1.default {
|
|
|
808
808
|
}
|
|
809
809
|
const space = ' '.repeat(tabCount);
|
|
810
810
|
let ymlString = `${space}items:\n`;
|
|
811
|
-
ymlString += `${space} type: ${this.replaceFromPropertyTypeToSwagger(arrayProperty.
|
|
812
|
-
if (((_a = arrayProperty.
|
|
811
|
+
ymlString += `${space} type: ${this.replaceFromPropertyTypeToSwagger(arrayProperty.item)}\n`;
|
|
812
|
+
if (((_a = arrayProperty.item.description) !== null && _a !== void 0 ? _a : '') !== '') {
|
|
813
813
|
const descJoin = `\n${space} `;
|
|
814
|
-
ymlString += `${space} description: |${descJoin}${((_b = arrayProperty.
|
|
814
|
+
ymlString += `${space} description: |${descJoin}${((_b = arrayProperty.item.description) !== null && _b !== void 0 ? _b : '').replaceAll('\n', descJoin)}\n`;
|
|
815
815
|
}
|
|
816
|
-
switch (arrayProperty.
|
|
816
|
+
switch (arrayProperty.item.type) {
|
|
817
817
|
case 'object':
|
|
818
818
|
case 'object?':
|
|
819
819
|
ymlString += this.makeSwaggerProperyFromObject([...keys, 0], tabCount + 1);
|
|
@@ -109,7 +109,7 @@ class ResponseType extends ReqResType_1.default {
|
|
|
109
109
|
}
|
|
110
110
|
let resData = [];
|
|
111
111
|
for (let i = 0; i < data.length; i++) {
|
|
112
|
-
switch (arrayProperty.
|
|
112
|
+
switch (arrayProperty.item.type) {
|
|
113
113
|
case 'object':
|
|
114
114
|
case 'object?':
|
|
115
115
|
resData.push(this.getObject([...keys, i]));
|
|
@@ -368,12 +368,12 @@ class ResponseType extends ReqResType_1.default {
|
|
|
368
368
|
}
|
|
369
369
|
const space = ' '.repeat(tabCount);
|
|
370
370
|
let ymlString = `${space}items:\n`;
|
|
371
|
-
ymlString += `${space} type: ${this.replaceFromPropertyTypeToSwagger(arrayProperty.
|
|
372
|
-
if (arrayProperty.
|
|
371
|
+
ymlString += `${space} type: ${this.replaceFromPropertyTypeToSwagger(arrayProperty.item)}\n`;
|
|
372
|
+
if (arrayProperty.item.description !== undefined) {
|
|
373
373
|
const joinSpace = `\n${space} `;
|
|
374
|
-
ymlString += `${space} description: |${joinSpace}${arrayProperty.
|
|
374
|
+
ymlString += `${space} description: |${joinSpace}${arrayProperty.item.description.replaceAll("\n", joinSpace)}\n`;
|
|
375
375
|
}
|
|
376
|
-
switch (arrayProperty.
|
|
376
|
+
switch (arrayProperty.item.type) {
|
|
377
377
|
case 'object':
|
|
378
378
|
case 'object?':
|
|
379
379
|
ymlString += this.makeSwaggerProperyFromObject([...keys, 0], tabCount + 1);
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ export type ObjectType = {
|
|
|
16
16
|
export type ArrayType = {
|
|
17
17
|
type: 'array' | 'array?';
|
|
18
18
|
description?: string;
|
|
19
|
-
|
|
19
|
+
item: PropertyType;
|
|
20
20
|
};
|
|
21
21
|
export type DictionaryType = {
|
|
22
22
|
type: 'dictionary' | 'dictionary?';
|
|
@@ -81,7 +81,7 @@ export default class ReqResType {
|
|
|
81
81
|
const key = keys[i];
|
|
82
82
|
if (typeof key === 'number') {
|
|
83
83
|
if (property.type === 'array' || property.type === 'array?') {
|
|
84
|
-
property = property.
|
|
84
|
+
property = property.item;
|
|
85
85
|
continue;
|
|
86
86
|
} else {
|
|
87
87
|
throw new Error(`getPropertyでnumber型のINPUTにも関わらず、array以外のtypeの場合のエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
@@ -94,17 +94,26 @@ export default class ReqResType {
|
|
|
94
94
|
if (typeof key !== 'number') {
|
|
95
95
|
throw new Error(`getPropertyでnumber型のINPUTで、array以外の場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
96
96
|
}
|
|
97
|
-
property = property.
|
|
97
|
+
property = property.item;
|
|
98
98
|
continue;
|
|
99
99
|
case 'object':
|
|
100
|
-
case 'object':
|
|
100
|
+
case 'object?':
|
|
101
101
|
if (typeof key !== 'string') {
|
|
102
102
|
throw new Error(`getPropertyでnumber型のINPUTで、arrayの場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
103
103
|
}
|
|
104
104
|
property = property.properties[key];
|
|
105
105
|
continue;
|
|
106
|
+
// case 'dictionary':
|
|
107
|
+
// case 'dictionary?':
|
|
108
|
+
// if (typeof key !== 'string') {
|
|
109
|
+
// throw new Error(`getPropertyでnumber型のINPUTで、arrayの場合はエラー\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
110
|
+
// }
|
|
111
|
+
// property = property.properties[key];
|
|
112
|
+
// continue;
|
|
106
113
|
default:
|
|
107
114
|
throw new Error(`getPropertyでarray,object以外のtypeを読み込もうとしている。\nキー一覧:${keys.join(',')} エラーキー:${key}`);
|
|
115
|
+
// property = property[key];
|
|
116
|
+
// continue;
|
|
108
117
|
}
|
|
109
118
|
}
|
|
110
119
|
|
|
@@ -236,7 +236,7 @@ export class RequestType extends ReqResType {
|
|
|
236
236
|
// GET,DELETEメソッドの場合、?array=1&array=2で配列となるが、
|
|
237
237
|
// ?array=1のみで終わる場合は配列にならないため、直接配列にしている
|
|
238
238
|
// この処理で空文字やnullが入った場合の対処をここで行う
|
|
239
|
-
const itemProperty = this.properties[key].
|
|
239
|
+
const itemProperty = this.properties[key].item;
|
|
240
240
|
if (itemProperty.type.endsWith('?')) {
|
|
241
241
|
const tempValue = this.data[key];
|
|
242
242
|
this.data[key] = [];
|
|
@@ -279,7 +279,7 @@ export class RequestType extends ReqResType {
|
|
|
279
279
|
if (request.method === 'GET' || request.method === 'DELETE') {
|
|
280
280
|
// GET,DELETEメソッドの場合、?array=1&array=2で配列となるが、
|
|
281
281
|
// ?array=1のみで終わる場合は配列にならないため、直接配列にしている
|
|
282
|
-
this.data[key] = [this.convertValue(this.properties[key].
|
|
282
|
+
this.data[key] = [this.convertValue(this.properties[key].item.type, value, [key, 0], true)];
|
|
283
283
|
} else {
|
|
284
284
|
this.throwInputError("ARRAY_01", [key], value);
|
|
285
285
|
}
|
|
@@ -383,8 +383,8 @@ export class RequestType extends ReqResType {
|
|
|
383
383
|
for (let i = 0;i < values.length; i++) {
|
|
384
384
|
|
|
385
385
|
// NULL Check
|
|
386
|
-
if (values[i] === undefined || values[i] === null || (property.
|
|
387
|
-
if (property.
|
|
386
|
+
if (values[i] === undefined || values[i] === null || (property.item.type.replace("?", "") !== "string" && values[i] === "")) {
|
|
387
|
+
if (property.item.type.endsWith('?')) {
|
|
388
388
|
this.changeBody([...keys, i], values[i] === undefined ? undefined : null);
|
|
389
389
|
continue;
|
|
390
390
|
} else {
|
|
@@ -392,7 +392,7 @@ export class RequestType extends ReqResType {
|
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
-
switch (property.
|
|
395
|
+
switch (property.item.type) {
|
|
396
396
|
case 'object':
|
|
397
397
|
case 'object?':
|
|
398
398
|
this.setObject([...keys, i], values[i]);
|
|
@@ -859,14 +859,14 @@ export class RequestType extends ReqResType {
|
|
|
859
859
|
const space = ' '.repeat(tabCount);
|
|
860
860
|
|
|
861
861
|
let ymlString = `${space}items:\n`;
|
|
862
|
-
ymlString += `${space} type: ${this.replaceFromPropertyTypeToSwagger(arrayProperty.
|
|
863
|
-
if ((arrayProperty.
|
|
862
|
+
ymlString += `${space} type: ${this.replaceFromPropertyTypeToSwagger(arrayProperty.item)}\n`;
|
|
863
|
+
if ((arrayProperty.item.description ?? '') !== '') {
|
|
864
864
|
const descJoin = `\n${space} `;
|
|
865
|
-
ymlString += `${space} description: |${descJoin}${(arrayProperty.
|
|
865
|
+
ymlString += `${space} description: |${descJoin}${(arrayProperty.item.description ?? '').replaceAll('\n', descJoin)}\n`;
|
|
866
866
|
}
|
|
867
867
|
|
|
868
868
|
|
|
869
|
-
switch (arrayProperty.
|
|
869
|
+
switch (arrayProperty.item.type) {
|
|
870
870
|
case 'object':
|
|
871
871
|
case 'object?':
|
|
872
872
|
ymlString += this.makeSwaggerProperyFromObject([...keys, 0], tabCount + 1);
|
|
@@ -118,7 +118,7 @@ export class ResponseType extends ReqResType {
|
|
|
118
118
|
|
|
119
119
|
let resData: Array<any> = [];
|
|
120
120
|
for (let i = 0;i < data.length; i++) {
|
|
121
|
-
switch (arrayProperty.
|
|
121
|
+
switch (arrayProperty.item.type) {
|
|
122
122
|
case 'object':
|
|
123
123
|
case 'object?':
|
|
124
124
|
resData.push(this.getObject([...keys, i]));
|
|
@@ -406,12 +406,12 @@ export class ResponseType extends ReqResType {
|
|
|
406
406
|
|
|
407
407
|
const space = ' '.repeat(tabCount);
|
|
408
408
|
let ymlString = `${space}items:\n`;
|
|
409
|
-
ymlString += `${space} type: ${this.replaceFromPropertyTypeToSwagger(arrayProperty.
|
|
410
|
-
if (arrayProperty.
|
|
409
|
+
ymlString += `${space} type: ${this.replaceFromPropertyTypeToSwagger(arrayProperty.item)}\n`;
|
|
410
|
+
if (arrayProperty.item.description !== undefined) {
|
|
411
411
|
const joinSpace = `\n${space} `;
|
|
412
|
-
ymlString += `${space} description: |${joinSpace}${arrayProperty.
|
|
412
|
+
ymlString += `${space} description: |${joinSpace}${arrayProperty.item.description.replaceAll("\n", joinSpace)}\n`;
|
|
413
413
|
}
|
|
414
|
-
switch (arrayProperty.
|
|
414
|
+
switch (arrayProperty.item.type) {
|
|
415
415
|
case 'object':
|
|
416
416
|
case 'object?':
|
|
417
417
|
ymlString += this.makeSwaggerProperyFromObject([...keys, 0], tabCount + 1);
|