pg-mvc-service 1.0.15 → 1.0.16
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.
|
@@ -21,12 +21,6 @@ const createSwagger = (services, name, url, params = []) => {
|
|
|
21
21
|
endpontSwaggerYml[service.Endpoint] = {};
|
|
22
22
|
}
|
|
23
23
|
let yml = "";
|
|
24
|
-
const splitEndpont = service.Endpoint.split('/');
|
|
25
|
-
let tagName = splitEndpont[0];
|
|
26
|
-
if (tagName === '' && splitEndpont.length > 1) {
|
|
27
|
-
tagName = splitEndpont[1];
|
|
28
|
-
;
|
|
29
|
-
}
|
|
30
24
|
const apiTags = service.Tags;
|
|
31
25
|
if (apiTags.length > 0) {
|
|
32
26
|
tags = [...tags, ...apiTags];
|
|
@@ -38,8 +32,8 @@ const createSwagger = (services, name, url, params = []) => {
|
|
|
38
32
|
yml += ` summary: ${service.Summary}\n`;
|
|
39
33
|
const croneParams = [...params];
|
|
40
34
|
for (const path of service.Endpoint.split('/')) {
|
|
41
|
-
if (path.startsWith('
|
|
42
|
-
const key = path.replace('
|
|
35
|
+
if (path.startsWith('{') && path.endsWith('}')) {
|
|
36
|
+
const key = path.replace('{', '').replace('}', '');
|
|
43
37
|
croneParams.push({
|
|
44
38
|
in: 'path',
|
|
45
39
|
name: key,
|
|
@@ -82,7 +76,7 @@ tags:\n`;
|
|
|
82
76
|
}
|
|
83
77
|
swaggerInfo += 'paths:\n';
|
|
84
78
|
for (const keyEndpoint in endpontSwaggerYml) {
|
|
85
|
-
swaggerInfo += ` ${keyEndpoint
|
|
79
|
+
swaggerInfo += ` ${keyEndpoint}:\n`;
|
|
86
80
|
setYmlByMethod('GET', endpontSwaggerYml[keyEndpoint]);
|
|
87
81
|
setYmlByMethod('POST', endpontSwaggerYml[keyEndpoint]);
|
|
88
82
|
setYmlByMethod('PUT', endpontSwaggerYml[keyEndpoint]);
|
package/package.json
CHANGED
package/src/documents/Swagger.ts
CHANGED
|
@@ -31,12 +31,6 @@ export const createSwagger = (services: Service[], name: string, url: string, pa
|
|
|
31
31
|
}
|
|
32
32
|
let yml = "";
|
|
33
33
|
|
|
34
|
-
const splitEndpont = service.Endpoint.split('/');
|
|
35
|
-
let tagName = splitEndpont[0];
|
|
36
|
-
if (tagName === '' && splitEndpont.length > 1) {
|
|
37
|
-
tagName = splitEndpont[1];;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
34
|
const apiTags = service.Tags;
|
|
41
35
|
if (apiTags.length > 0) {
|
|
42
36
|
tags = [ ...tags, ...apiTags];
|
|
@@ -49,8 +43,8 @@ export const createSwagger = (services: Service[], name: string, url: string, pa
|
|
|
49
43
|
|
|
50
44
|
const croneParams = [...params];
|
|
51
45
|
for (const path of service.Endpoint.split('/')) {
|
|
52
|
-
if (path.startsWith('
|
|
53
|
-
const key = path.replace('
|
|
46
|
+
if (path.startsWith('{') && path.endsWith('}')) {
|
|
47
|
+
const key = path.replace('{', '').replace('}', '');
|
|
54
48
|
croneParams.push({
|
|
55
49
|
in: 'path',
|
|
56
50
|
name: key,
|
|
@@ -98,7 +92,7 @@ tags:\n`;
|
|
|
98
92
|
swaggerInfo += 'paths:\n'
|
|
99
93
|
|
|
100
94
|
for (const keyEndpoint in endpontSwaggerYml) {
|
|
101
|
-
swaggerInfo += ` ${keyEndpoint
|
|
95
|
+
swaggerInfo += ` ${keyEndpoint}:\n`;
|
|
102
96
|
|
|
103
97
|
setYmlByMethod('GET', endpontSwaggerYml[keyEndpoint]);
|
|
104
98
|
setYmlByMethod('POST', endpontSwaggerYml[keyEndpoint]);
|