core package for OpenAPI toolkit
npm install @opas/core
import { OpenAPIRunner } from '@opas/core'
await OpenAPIRunner.run([
{
url: `your open api spec url or file path`,
namespace: `your namespace`,
plugins: [], // apply plugins here
postSchema: (schema: Schema) => PromiseLike<Schema> | Schema?, // Option | Type | Description
},
])
Parse OpenAPI spec
Option | Type | Description |
---|---|---|
namespace |
string |
TypeScript Definitions Namespace |
url |
string |
OpenAPI schema json url, a http(s) url or file path |
postSchema |
(schema: Schema) => PromiseLike<Schema> | Schema? |
post process schema |
Base class for OpenAPI plugin
Option | Type | Description |
---|---|---|
cwd |
string? |
Current working directory |
Run OpenAPI plugins
Option | Type | Description |
---|---|---|
plugins |
OpenAPIPlugin<OpenAPIPluginOptions>[]? |
List of OpenAPI plugins |
namespaces |
ParserOptions[] |
List of parser options for namespaces |
Transform OpenAPI spec
transformer options extends OpenAPIParserOptions
, and adds the following options:
Option | Type | Description |
---|---|---|
plugins |
OpenAPIPlugin<OpenAPIPluginOptions>[]? |
List of OpenAPI plugins |