@asyncapi/converter 1.5.0 → 1.5.1
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/README.md +6 -5
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,8 @@ Convert [AsyncAPI](https://asyncapi.com) documents older to newer versions and y
|
|
|
17
17
|
* [In TS](#in-ts)
|
|
18
18
|
- [Conversion 2.x.x to 3.x.x](#conversion-2xx-to-3xx)
|
|
19
19
|
- [Known missing features](#known-missing-features)
|
|
20
|
-
|
|
20
|
+
* [OpenAPI 3.0 to AsyncAPI 3.0 Conversion](#openapi-30-to-asyncapi-30-conversion)
|
|
21
|
+
+ [Limitations](#limitations)
|
|
21
22
|
- [Development](#development)
|
|
22
23
|
- [Contribution](#contribution)
|
|
23
24
|
- [Contributors ✨](#contributors-%E2%9C%A8)
|
|
@@ -203,11 +204,11 @@ To use this new conversion feature:
|
|
|
203
204
|
|
|
204
205
|
```js
|
|
205
206
|
const fs = require('fs');
|
|
206
|
-
const {
|
|
207
|
+
const { convertOpenAPI } = require('@asyncapi/converter')
|
|
207
208
|
|
|
208
209
|
try {
|
|
209
210
|
const openapi = fs.readFileSync('openapi.yml', 'utf-8')
|
|
210
|
-
const asyncapi =
|
|
211
|
+
const asyncapi = convertOpenAPI(openapi, '3.0.0', { from: 'openapi' });
|
|
211
212
|
console.log(asyncapi);
|
|
212
213
|
} catch (e) {
|
|
213
214
|
console.error(e);
|
|
@@ -217,11 +218,11 @@ try {
|
|
|
217
218
|
When converting from OpenAPI to AsyncAPI you can now specify the perspective of the conversion using the `perspective` option. This allows you to choose whether the conversion should be from an application or client point of view
|
|
218
219
|
|
|
219
220
|
```js
|
|
220
|
-
const {
|
|
221
|
+
const { convertOpenAPI } = require('@asyncapi/converter')
|
|
221
222
|
|
|
222
223
|
try {
|
|
223
224
|
const asyncapi2 = fs.readFileSync('asyncapi2.yml', 'utf-8')
|
|
224
|
-
const asyncapi3 =
|
|
225
|
+
const asyncapi3 = convertOpenAPI(asyncapi2, '3.0.0', { openAPIToAsyncAPI: { perspective: 'client' } });
|
|
225
226
|
console.log(asyncapi3);
|
|
226
227
|
} catch (e) {
|
|
227
228
|
console.error(e);
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { convert } from './convert';
|
|
1
|
+
export { convert, convertOpenAPI } from './convert';
|
|
2
2
|
export type { AsyncAPIDocument, AsyncAPIConvertVersion, OpenAPIConvertVersion, ConvertOptions } from './interfaces';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convert = void 0;
|
|
3
|
+
exports.convertOpenAPI = exports.convert = void 0;
|
|
4
4
|
var convert_1 = require("./convert");
|
|
5
5
|
Object.defineProperty(exports, "convert", { enumerable: true, get: function () { return convert_1.convert; } });
|
|
6
|
+
Object.defineProperty(exports, "convertOpenAPI", { enumerable: true, get: function () { return convert_1.convertOpenAPI; } });
|