JSPM

  • Created
  • Published
  • Downloads 18286
  • Score
    100M100P100Q146281F
  • License MIT

Convert OpenAPI 3.0 or Swagger 2.0 definitions into aspida

Package Exports

  • openapi2aspida

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (openapi2aspida) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

OpenAPI or Swagger to aspida

aspida aspida-mock openapi2aspida pathpida
@aspida/axios @aspida/ky @aspida/fetch @aspida/node-fetch





aspida




Convert OpenAPI 3.0 or Swagger 2.0 definitions into aspida.



Getting Started

Create config file in project root

aspida.config.js

module.exports = {
  input: "apis", // "input" of aspida is "output" for openapi2aspida
  openapi: { inputFile: "https://petstore.swagger.io/v2/swagger.json" } // Compatible with yaml/json of OpenAPI3.0/Swagger2.0
}

tarminal

$ npx openapi2aspida --build
# apis/$api.ts was built successfully.

Getting Started with aspida-mock

Installation (@aspida/axios only mock compatible)

  • Using npm:

    $ npm install @aspida/axios axios
    $ npm install aspida-mock --save-dev
  • Using Yarn:

    $ yarn add @aspida/axios axios
    $ yarn add aspida-mock --dev

package.json

{
  "scripts": {
    "build": "aspida-mock --build"
  }
}

aspida.config.js

module.exports = {
  openapi: { inputFile: "https://petstore.swagger.io/v2/swagger.json", mock: true }
}

tarminal

$ npx openapi2aspida --build
# apis/$api.ts was built successfully.
$ npm run build
# apis/$mock.ts was built successfully.

License

openapi2aspida is licensed under a MIT License.