https://github.com/kagawagao/opas
Open API toolkit for TS/JS
https://github.com/kagawagao/opas
Last synced: about 2 months ago
JSON representation
Open API toolkit for TS/JS
- Host: GitHub
- URL: https://github.com/kagawagao/opas
- Owner: kagawagao
- License: mit
- Created: 2023-12-21T03:34:00.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-08T05:57:56.000Z (about 1 year ago)
- Last Synced: 2024-04-08T06:41:47.294Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 661 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# OPAS
Open API toolkit for TS/JS
[](https://github.com/kagawagao/opas/actions/workflows/build.yml) [](https://github.com/kagawagao/opas/actions/workflows/codeql-analysis.yml)
## Features
- [x] Generate API definitions from OpenAPI 2/3 spec
- [x] Generate API docs from OpenAPI 2/3 spec
- [x] Generate API client from OpenAPI 2/3 spec
- [x] Generate API SDK from OpenAPI 2/3 spec## Fundamentals
### Core packages
| Package | Version | Description |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| [`@opas/core`](./packages/core) | [](https://www.npmjs.com/package/@opas/core) | Core package for OpenAPI toolkit |
| [`@opas/cli`](./packages/cli/) | [](https://www.npmjs.com/package/@opas/cli) | CLI for OpenAPI toolkit |
| [`@opas/helper`](./packages/helper) | [](https://www.npmjs.com/package/@opas/helper) | Helper functions for OpenAPI toolkit |### Plugins
| Package | Version | Description |
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| [`@opas/plugin-app`](./plugins/app) | [](https://www.npmjs.com/package/@opas/plugin-app) | Plugin for generating API client |
| [`@opas/plugin-sdk`](./plugins/sdk) | [](https://www.npmjs.com/package/@opas/plugin-sdk) | Plugin for generating API SDK |
| [`@opas/plugin-doc`](./plugins/doc) | [](https://www.npmjs.com/package/@opas/plugin-doc) | Plugin for generating API docs |
| [`@opas/plugin-definition`](./plugins/definition) | [](https://www.npmjs.com/package/@opas/plugin-definition) | Plugin for generating API definitions |## Usage
### Install
```bash
npm install @opas/core
```### Example
```typescript
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