Skip to content

Commit

Permalink
added the readme section for conversion of postman to asyncapi
Browse files Browse the repository at this point in the history
  • Loading branch information
ItshMoh committed Sep 7, 2024
1 parent 5687dfd commit 64ac5c5
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,48 @@ The perspective option can be set to either 'server' (default) or 'client'.

- External to internal references: The converter does not support scenarios where an external schema file references internal components of the OpenAPI document. In such cases, manual adjustment of the converted document may be necessary.

### Postman Collection to AsyncAPI conversion

The converter now also supports conversion from postman collection to AsyncAPI 3.0. This feature enables easy transition of existing postman collection to any AsyncAPI 3.0 documents.

To use this new conversion feature:

```js
const fs = require('fs');
const { convertPostman } = require('@asyncapi/converter')
try {
const postman = fs.readFileSync('postman-collection.yml', 'utf-8')
const asyncapi = convertPostman(postman, '3.0.0');
console.log(asyncapi);
} catch (e) {
console.error(e);
}
```

When converting from postman collection 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 { convertPostman } = require('@asyncapi/converter')
try {
const postman = fs.readFileSync('postman-collection.yml', 'utf-8')
const asyncapi = convertPostman(postman, '3.0.0', { perspective: 'client' });
console.log(asyncapi);
} catch (e) {
console.error(e);
}
```

The perspective option can be set to either 'server' (default) or 'client'.

- With `server` perspective: `action` becomes `receive`

- With `client` perspective: `action` becomes `send`

#### Limitations

- External to internal references: The converter does not support scenarios where an external schema file references internal components of the OpenAPI document. In such cases, manual adjustment of the converted document may be necessary.


## Development

1. Setup project by installing dependencies `npm install`
Expand Down

0 comments on commit 64ac5c5

Please sign in to comment.