openapi-sync 1.0.17 → 1.0.19

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) => {
@@ -120,11 +120,22 @@ const OpenapiSync = (apiUrl, apiName, refetchInterval) => __awaiter(void 0, void
120
120
  const endpoint = (0, helpers_1.getEndpointDetails)(endpointPath, method);
121
121
  const endpointUrlTxt = endpoint.pathParts
122
122
  .map((part) => {
123
+ console.log("2nd part", part);
123
124
  // check if part is a variable
124
125
  if (part[0] === "{" && part[part.length - 1] === "}") {
125
126
  const s = part.replace(/{/, "").replace(/}/, "");
126
127
  part = `\${${s}}`;
127
128
  }
129
+ //api/<userId>
130
+ else if (part[0] === "<" && part[part.length - 1] === ">") {
131
+ const s = part.replace(/</, "").replace(/>/, "");
132
+ part = `\${${s}}`;
133
+ }
134
+ //api/:userId
135
+ else if (part[0] === ":") {
136
+ const s = part.replace(/:/, "");
137
+ part = `\${${s}}`;
138
+ }
128
139
  return part;
129
140
  })
130
141
  .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.19",
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",