Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 3.44 KB

README.md

File metadata and controls

64 lines (48 loc) · 3.44 KB

OPAS

Open API toolkit for TS/JS

build CodeQL

Features

  • 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

Fundamentals

Core packages

Package Version Description
@opas/core NPM Version Core package for OpenAPI toolkit
@opas/cli NPM Version CLI for OpenAPI toolkit
@opas/helper NPM Version Helper functions for OpenAPI toolkit

Plugins

Package Version Description
@opas/plugin-app NPM Version Plugin for generating API client
@opas/plugin-sdk NPM Version Plugin for generating API SDK
@opas/plugin-doc NPM Version Plugin for generating API docs
@opas/plugin-definition NPM Version Plugin for generating API definitions

Usage

Install

npm install @opas/core

Example

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