pg-mvc-service 1.0.2 → 1.0.4

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.
@@ -38,8 +38,8 @@ const createSwagger = (services, name, url, params = []) => {
38
38
  yml += ` summary: ${service.Summary}\n`;
39
39
  const croneParams = [...params];
40
40
  for (const path of service.Endpoint.split('/')) {
41
- if (path.includes('{') && path.includes('}')) {
42
- const key = path.replace('{', '').replace('}', '');
41
+ if (path.startsWith(':')) {
42
+ const key = path.replace(':', '');
43
43
  croneParams.push({
44
44
  in: 'path',
45
45
  name: key,
@@ -82,7 +82,7 @@ tags:\n`;
82
82
  }
83
83
  swaggerInfo += 'paths:\n';
84
84
  for (const keyEndpoint in endpontSwaggerYml) {
85
- swaggerInfo += ` ${keyEndpoint}:\n`;
85
+ swaggerInfo += ` ${keyEndpoint.replace(/\/:([^\/]+)/g, '/{$1}')}:\n`;
86
86
  setYmlByMethod('GET', endpontSwaggerYml[keyEndpoint]);
87
87
  setYmlByMethod('POST', endpontSwaggerYml[keyEndpoint]);
88
88
  setYmlByMethod('PUT', endpontSwaggerYml[keyEndpoint]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-mvc-service",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
6
6
  "bugs": {
@@ -49,8 +49,8 @@ export const createSwagger = (services: Service[], name: string, url: string, pa
49
49
 
50
50
  const croneParams = [...params];
51
51
  for (const path of service.Endpoint.split('/')) {
52
- if (path.includes('{') && path.includes('}')) {
53
- const key = path.replace('{', '').replace('}', '');
52
+ if (path.startsWith(':')) {
53
+ const key = path.replace(':', '');
54
54
  croneParams.push({
55
55
  in: 'path',
56
56
  name: key,
@@ -98,7 +98,7 @@ tags:\n`;
98
98
  swaggerInfo += 'paths:\n'
99
99
 
100
100
  for (const keyEndpoint in endpontSwaggerYml) {
101
- swaggerInfo += ` ${keyEndpoint}:\n`;
101
+ swaggerInfo += ` ${keyEndpoint.replace(/\/:([^\/]+)/g, '/{$1}')}:\n`;
102
102
 
103
103
  setYmlByMethod('GET', endpontSwaggerYml[keyEndpoint]);
104
104
  setYmlByMethod('POST', endpontSwaggerYml[keyEndpoint]);