openapi-sync 1.0.17 → 1.0.20

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.
@@ -72,11 +72,24 @@ const getEndpointDetails = (path, method) => {
72
72
  const variables = [];
73
73
  pathParts.forEach((part) => {
74
74
  // check if part is a variable
75
+ //api/{userId}
75
76
  if (part[0] === "{" && part[part.length - 1] === "}") {
76
77
  const s = part.replace(/{/, "").replace(/}/, "");
77
78
  variables.push(s);
78
79
  part = `$${s}`;
79
80
  }
81
+ //api/<userId>
82
+ else if (part[0] === "<" && part[part.length - 1] === ">") {
83
+ const s = part.replace(/</, "").replace(/>/, "");
84
+ variables.push(s);
85
+ part = `$${s}`;
86
+ }
87
+ //api/:userId
88
+ else if (part[0] === ":") {
89
+ const s = part.replace(/:/, "");
90
+ variables.push(s);
91
+ part = `$${s}`;
92
+ }
80
93
  // parse to variable name
81
94
  let partVal = "";
82
95
  part.split("").forEach((char) => {
@@ -125,6 +125,16 @@ const OpenapiSync = (apiUrl, apiName, refetchInterval) => __awaiter(void 0, void
125
125
  const s = part.replace(/{/, "").replace(/}/, "");
126
126
  part = `\${${s}}`;
127
127
  }
128
+ //api/<userId>
129
+ else if (part[0] === "<" && part[part.length - 1] === ">") {
130
+ const s = part.replace(/</, "").replace(/>/, "");
131
+ part = `\${${s}}`;
132
+ }
133
+ //api/:userId
134
+ else if (part[0] === ":") {
135
+ const s = part.replace(/:/, "");
136
+ part = `\${${s}}`;
137
+ }
128
138
  return part;
129
139
  })
130
140
  .join("/");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-sync",
3
- "version": "1.0.17",
3
+ "version": "1.0.20",
4
4
  "description": "A developer-friendly tool designed to keep your API up-to-date by leveraging OpenAPI schemas. It automates the generation of endpoint URIs and type definitions, including shared types, directly from your OpenAPI specification.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",