moahmedwafy commited on
Commit
532c8f0
·
unverified ·
2 Parent(s): 329acb2 37f7454

Merge pull request #74 from Modarb-Ai-Trainer/docs

Browse files
Files changed (1) hide show
  1. src/lib/swagger/swagger.ts +5 -3
src/lib/swagger/swagger.ts CHANGED
@@ -121,7 +121,9 @@ class SwaggerRegistry {
121
 
122
  controllerData.routes.forEach((route) => {
123
  route.path = `/api/v1${controllerData.prefix}${route.path}`;
124
- const params = route.path.match(/:(\w+)/g);
 
 
125
 
126
  if (!paths[route.path]) {
127
  paths[route.path] = {};
@@ -140,7 +142,7 @@ class SwaggerRegistry {
140
  ...((params &&
141
  params.map((param) => {
142
  return {
143
- name: param.replace(":", ""),
144
  in: "path",
145
  required: true,
146
  schema: {
@@ -204,7 +206,7 @@ class SwaggerRegistry {
204
  },
205
  };
206
 
207
- // console.log(JSON.stringify(document, null, 2));
208
  return document;
209
  }
210
  }
 
121
 
122
  controllerData.routes.forEach((route) => {
123
  route.path = `/api/v1${controllerData.prefix}${route.path}`;
124
+ // convert :param to {param}
125
+ route.path = route.path.replace(/:(\w+)/g, "{$1}");
126
+ const params = route.path.match(/{(\w+)}/g);
127
 
128
  if (!paths[route.path]) {
129
  paths[route.path] = {};
 
142
  ...((params &&
143
  params.map((param) => {
144
  return {
145
+ name: param.replace(/{|}/g, ""),
146
  in: "path",
147
  required: true,
148
  schema: {
 
206
  },
207
  };
208
 
209
+ //console.log(JSON.stringify(document, null, 2));
210
  return document;
211
  }
212
  }