pg-mvc-service 2.0.55 → 2.0.57
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.
|
@@ -59,35 +59,34 @@ class ResponseType extends ReqResType_1.default {
|
|
|
59
59
|
getObject(keys) {
|
|
60
60
|
let resData = {};
|
|
61
61
|
const data = this.getData(keys);
|
|
62
|
+
console.log("getObject", keys.join(','));
|
|
62
63
|
const objectProperty = this.getProperty(keys);
|
|
63
64
|
if (objectProperty.type !== 'object' && objectProperty.type !== 'object?') {
|
|
64
65
|
throw new Error(`getObjectメソッドでObject型以外が入力された場合はエラー\n keys: ${keys.join(',')}`);
|
|
65
66
|
}
|
|
66
|
-
console.log(objectProperty);
|
|
67
|
-
for (const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
67
|
+
console.log("getObject", objectProperty);
|
|
68
|
+
for (const key of Object.keys(objectProperty.properties)) {
|
|
69
|
+
console.log("getObject : ", key);
|
|
70
|
+
if (key in data === false || data[key] === undefined) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const property = objectProperty.properties[key];
|
|
74
|
+
if (data[key] === null || (property.type.replace("?", "") !== "string" && data[key] === "")) {
|
|
75
|
+
resData[key] = property.type.endsWith('?') ? null : undefined;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
switch (property.type) {
|
|
79
|
+
case 'object':
|
|
80
|
+
case 'object?':
|
|
81
|
+
resData[key] = this.getObject([...keys, key]);
|
|
82
|
+
break;
|
|
83
|
+
case 'array':
|
|
84
|
+
case 'array?':
|
|
85
|
+
resData[key] = this.getArray([...keys, key]);
|
|
86
|
+
break;
|
|
87
|
+
default:
|
|
88
|
+
resData[key] = this.getValue([...keys, key]);
|
|
89
|
+
break;
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
return resData;
|
|
@@ -112,9 +111,7 @@ class ResponseType extends ReqResType_1.default {
|
|
|
112
111
|
switch (arrayProperty.properties.type) {
|
|
113
112
|
case 'object':
|
|
114
113
|
case 'object?':
|
|
115
|
-
|
|
116
|
-
console.log(value);
|
|
117
|
-
resData.push(value);
|
|
114
|
+
resData.push(this.getObject([...keys, i]));
|
|
118
115
|
break;
|
|
119
116
|
case 'array':
|
|
120
117
|
case 'array?':
|
|
@@ -328,7 +325,7 @@ class ResponseType extends ReqResType_1.default {
|
|
|
328
325
|
makeSwaggerProperyFromObject(keys, tabCount) {
|
|
329
326
|
const objectProperty = this.getProperty(keys);
|
|
330
327
|
if (objectProperty.type !== 'object' && objectProperty.type !== 'object?') {
|
|
331
|
-
throw new Error(`
|
|
328
|
+
throw new Error(`makeSwaggerProperyFromObjectメソッドでObject型以外が入力された場合はエラー\n keys: ${keys.join(',')}`);
|
|
332
329
|
}
|
|
333
330
|
const space = ' '.repeat(tabCount);
|
|
334
331
|
let ymlString = `${space}properties:\n`;
|
package/package.json
CHANGED
|
@@ -60,38 +60,37 @@ export class ResponseType extends ReqResType {
|
|
|
60
60
|
let resData: {[key: string]: any} = {};
|
|
61
61
|
const data = this.getData(keys);
|
|
62
62
|
|
|
63
|
+
console.log("getObject", keys.join(','))
|
|
63
64
|
const objectProperty = this.getProperty(keys);
|
|
64
65
|
if (objectProperty.type !== 'object' && objectProperty.type !== 'object?') {
|
|
65
66
|
throw new Error(`getObjectメソッドでObject型以外が入力された場合はエラー\n keys: ${keys.join(',')}`);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
console.log(objectProperty);
|
|
69
|
-
for (const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
69
|
+
console.log("getObject", objectProperty);
|
|
70
|
+
for (const key of Object.keys(objectProperty.properties)) {
|
|
71
|
+
console.log("getObject : ", key);
|
|
72
|
+
if (key in data === false || data[key] === undefined) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const property = objectProperty.properties[key];
|
|
77
|
+
if (data[key] === null || (property.type.replace("?", "") !== "string" && data[key] === "")) {
|
|
78
|
+
resData[key] = property.type.endsWith('?') ? null : undefined;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
switch (property.type) {
|
|
83
|
+
case 'object':
|
|
84
|
+
case 'object?':
|
|
85
|
+
resData[key] = this.getObject([...keys, key]);
|
|
86
|
+
break;
|
|
87
|
+
case 'array':
|
|
88
|
+
case 'array?':
|
|
89
|
+
resData[key] = this.getArray([...keys, key]);
|
|
90
|
+
break;
|
|
91
|
+
default:
|
|
92
|
+
resData[key] = this.getValue([...keys, key]);
|
|
93
|
+
break;
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
|
|
@@ -121,9 +120,7 @@ export class ResponseType extends ReqResType {
|
|
|
121
120
|
switch (arrayProperty.properties.type) {
|
|
122
121
|
case 'object':
|
|
123
122
|
case 'object?':
|
|
124
|
-
|
|
125
|
-
console.log(value)
|
|
126
|
-
resData.push(value);
|
|
123
|
+
resData.push(this.getObject([...keys, i]));
|
|
127
124
|
break;
|
|
128
125
|
case 'array':
|
|
129
126
|
case 'array?':
|
|
@@ -360,7 +357,7 @@ export class ResponseType extends ReqResType {
|
|
|
360
357
|
|
|
361
358
|
const objectProperty = this.getProperty(keys);
|
|
362
359
|
if (objectProperty.type !== 'object' && objectProperty.type !== 'object?') {
|
|
363
|
-
throw new Error(`
|
|
360
|
+
throw new Error(`makeSwaggerProperyFromObjectメソッドでObject型以外が入力された場合はエラー\n keys: ${keys.join(',')}`);
|
|
364
361
|
}
|
|
365
362
|
|
|
366
363
|
const space = ' '.repeat(tabCount);
|