Skip to content

Commit

Permalink
fix: the wrong import and updated readme (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gmin2 authored Aug 19, 2024
1 parent c2a08ff commit bd81aee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ To use this new conversion feature:

```js
const fs = require('fs');
const { convert } = require('@asyncapi/converter')
const { convertOpenAPI } = require('@asyncapi/converter')
try {
const openapi = fs.readFileSync('openapi.yml', 'utf-8')
const asyncapi = convert(openapi, '3.0.0', { from: 'openapi' });
const asyncapi = convertOpenAPI(openapi, '3.0.0', { from: 'openapi' });
console.log(asyncapi);
} catch (e) {
console.error(e);
Expand All @@ -218,11 +218,11 @@ try {
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

```js
const { convert } = require('@asyncapi/converter')
const { convertOpenAPI } = require('@asyncapi/converter')
try {
const asyncapi2 = fs.readFileSync('asyncapi2.yml', 'utf-8')
const asyncapi3 = convert(asyncapi2, '3.0.0', { openAPIToAsyncAPI: { perspective: 'client' } });
const asyncapi3 = convertOpenAPI(asyncapi2, '3.0.0', { openAPIToAsyncAPI: { perspective: 'client' } });
console.log(asyncapi3);
} catch (e) {
console.error(e);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { convert } from './convert';
export { convert, convertOpenAPI } from './convert';

export type { AsyncAPIDocument, AsyncAPIConvertVersion, OpenAPIConvertVersion, ConvertOptions } from './interfaces';

0 comments on commit bd81aee

Please sign in to comment.