Skip to content

Commit

Permalink
add migration
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Jun 25, 2024
1 parent bec5d5d commit 6f7d525
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/migrations/v3-to-v4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Migrating from v2 to v3

The ONLY thing that changes between v3 and v4 has to do with the standalone browser bundle.

## New browser bundle

In the old browser bundle you only had access to the parser.

```js
const parser = new window.AsyncAPIParser();
const spec = '{ ... }';
const { document: parsedDocument, diagnostics } = await parser.parse(spec);
```

With the new browser bundle, you have access a bunch of support functions such as `fromURL`, `convertToOldAPI`, `unstringify`, `stringify`.

```js
const parser = new window.AsyncAPIParser.Parser();
const spec = '{ ... }';
const { document: parsedDocument, diagnostics } = await parser.parse(spec);
...
const result = window.AsyncAPIParser.fromURL(parser, 'http://localhost:8080/asyncapi.json');
const {document: parsedDocument, diagnostics} = await result.parse();
```

0 comments on commit 6f7d525

Please sign in to comment.