diff --git a/.changeset/gentle-hairs-raise.md b/.changeset/gentle-hairs-raise.md new file mode 100644 index 0000000..979b705 --- /dev/null +++ b/.changeset/gentle-hairs-raise.md @@ -0,0 +1,5 @@ +--- +'@scalar/openapi-parser': minor +--- + +refactor!: use dedicated entrypoints for the plugins diff --git a/README.md b/README.md index 0573338..b4586a8 100644 --- a/README.md +++ b/README.md @@ -133,23 +133,25 @@ const result = openapi() You can reference other files, too. To do that, the parser needs to know what files are available. ```ts -import { - dereference, - fetchUrlsPlugin, - load, - readFilesPlugin, -} from '@scalar/openapi-parser' +import { dereference, load } from '@scalar/openapi-parser' +import { fetchUrls } from '@scalar/openapi-parser/plugins/fetch-urls' +import { readFiles } from '@scalar/openapi-parser/plugins/read-files' // Load a file and all referenced files const { filesystem } = await load('./openapi.yaml', { - plugins: [readFilesPlugin(), fetchUrlsPlugin()], + plugins: [ + readFiles(), + fetchUrls({ + limit: 5, + }), + ], }) // Instead of just passing a single specification, pass the whole “filesystem” const result = await dereference(filesystem) ``` -As you see, `load()` supports plugin. You can write your own plugin, if you’d like to fetch API defintions from another data source, for example your database. Look at the source code of the `readFilesPlugin` to learn how this could look like. +As you see, `load()` supports plugin. You can write your own plugin, if you’d like to fetch API defintions from another data source, for example your database. Look at the source code of the `readFiles` to learn how this could look like. ## Community diff --git a/demo/src/App.vue b/demo/src/App.vue index e5b0737..a6b3f4d 100644 --- a/demo/src/App.vue +++ b/demo/src/App.vue @@ -1,5 +1,6 @@