-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bec5d5d
commit 6f7d525
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
``` |