oas-normalize 8.1.2 → 8.1.3

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.
package/dist/index.d.ts CHANGED
@@ -21,6 +21,10 @@ export default class OASNormalize {
21
21
  * @private
22
22
  */
23
23
  load(): Promise<any>;
24
+ /**
25
+ * @private
26
+ */
27
+ static convertPostmanToOpenAPI(schema: any): Promise<any>;
24
28
  /**
25
29
  * Bundle up the given API definition, resolving any external `$ref` pointers in the process.
26
30
  *
package/dist/index.js CHANGED
@@ -138,6 +138,12 @@ var OASNormalize = /** @class */ (function () {
138
138
  });
139
139
  });
140
140
  };
141
+ /**
142
+ * @private
143
+ */
144
+ OASNormalize.convertPostmanToOpenAPI = function (schema) {
145
+ return (0, postman_to_openapi_1["default"])(JSON.stringify(schema), null, { outputFormat: 'json', replaceVars: true }).then(JSON.parse);
146
+ };
141
147
  /**
142
148
  * Bundle up the given API definition, resolving any external `$ref` pointers in the process.
143
149
  *
@@ -154,7 +160,7 @@ var OASNormalize = /** @class */ (function () {
154
160
  // upconvert it to an OpenAPI definition file so our returned dataset is always one of
155
161
  // those for a Postman dataset.
156
162
  if (utils.isPostman(schema)) {
157
- return (0, postman_to_openapi_1["default"])(JSON.stringify(schema), null, { outputFormat: 'json' }).then(JSON.parse);
163
+ return OASNormalize.convertPostmanToOpenAPI(schema);
158
164
  }
159
165
  return schema;
160
166
  })
@@ -182,7 +188,7 @@ var OASNormalize = /** @class */ (function () {
182
188
  // still upconvert it to an OpenAPI definition file so our returned dataset is always one
183
189
  // of those for a Postman dataset.
184
190
  if (utils.isPostman(schema)) {
185
- return (0, postman_to_openapi_1["default"])(JSON.stringify(schema), null, { outputFormat: 'json' }).then(JSON.parse);
191
+ return OASNormalize.convertPostmanToOpenAPI(schema);
186
192
  }
187
193
  return schema;
188
194
  })
@@ -216,7 +222,7 @@ var OASNormalize = /** @class */ (function () {
216
222
  if (!utils.isPostman(schema)) {
217
223
  return [2 /*return*/, schema];
218
224
  }
219
- return [2 /*return*/, (0, postman_to_openapi_1["default"])(JSON.stringify(schema), null, { outputFormat: 'json' }).then(JSON.parse)];
225
+ return [2 /*return*/, OASNormalize.convertPostmanToOpenAPI(schema)];
220
226
  });
221
227
  }); })
222
228
  .then(function (schema) { return __awaiter(_this, void 0, void 0, function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oas-normalize",
3
- "version": "8.1.2",
3
+ "version": "8.1.3",
4
4
  "description": "Tooling for converting, valiating, and parsing OpenAPI, Swagger, and Postman API definitions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -87,6 +87,13 @@ export default class OASNormalize {
87
87
  }
88
88
  }
89
89
 
90
+ /**
91
+ * @private
92
+ */
93
+ static convertPostmanToOpenAPI(schema: any) {
94
+ return postmanToOpenAPI(JSON.stringify(schema), null, { outputFormat: 'json', replaceVars: true }).then(JSON.parse);
95
+ }
96
+
90
97
  /**
91
98
  * Bundle up the given API definition, resolving any external `$ref` pointers in the process.
92
99
  *
@@ -100,7 +107,7 @@ export default class OASNormalize {
100
107
  // upconvert it to an OpenAPI definition file so our returned dataset is always one of
101
108
  // those for a Postman dataset.
102
109
  if (utils.isPostman(schema)) {
103
- return postmanToOpenAPI(JSON.stringify(schema), null, { outputFormat: 'json' }).then(JSON.parse);
110
+ return OASNormalize.convertPostmanToOpenAPI(schema);
104
111
  }
105
112
 
106
113
  return schema;
@@ -125,7 +132,7 @@ export default class OASNormalize {
125
132
  // still upconvert it to an OpenAPI definition file so our returned dataset is always one
126
133
  // of those for a Postman dataset.
127
134
  if (utils.isPostman(schema)) {
128
- return postmanToOpenAPI(JSON.stringify(schema), null, { outputFormat: 'json' }).then(JSON.parse);
135
+ return OASNormalize.convertPostmanToOpenAPI(schema);
129
136
  }
130
137
 
131
138
  return schema;
@@ -164,7 +171,7 @@ export default class OASNormalize {
164
171
  return schema;
165
172
  }
166
173
 
167
- return postmanToOpenAPI(JSON.stringify(schema), null, { outputFormat: 'json' }).then(JSON.parse);
174
+ return OASNormalize.convertPostmanToOpenAPI(schema);
168
175
  })
169
176
  .then(async schema => {
170
177
  if (!utils.isSwagger(schema) && !utils.isOpenAPI(schema)) {