Open API toolkit for TS/JS
- Generate API definitions from OpenAPI 2/3 spec
- Generate API docs from OpenAPI 2/3 spec
- Generate API client from OpenAPI 2/3 spec
- Generate API SDK from OpenAPI 2/3 spec
Package | Version | Description |
---|---|---|
@opas/core |
Core package for OpenAPI toolkit | |
@opas/cli |
CLI for OpenAPI toolkit | |
@opas/helper |
Helper functions for OpenAPI toolkit |
Package | Version | Description |
---|---|---|
@opas/plugin-app |
Plugin for generating API client | |
@opas/plugin-sdk |
Plugin for generating API SDK | |
@opas/plugin-doc |
Plugin for generating API docs | |
@opas/plugin-definition |
Plugin for generating API definitions |
npm install @opas/core
import { OpenAPIRunner } from '@opas/core'
import OpenAPITransformDefinitionPlugin from '@opas/plugin-definition'
await OpenAPIRunner.run([
{
url: `your open api spec url or file path`,
namespace: `your namespace`,
plugins: [
new OpenAPITransformDefinitionPlugin({
outputDir: `your output dir`,
}),
],
postSchema: (schema) => {
// do something with schema, e.g. modify schema
return schema
},
},
])
More examples can be found in the test directory of each plugin