Skip to content

Latest commit

 

History

History
77 lines (51 loc) · 1.93 KB

setting-up.md

File metadata and controls

77 lines (51 loc) · 1.93 KB

Setting up a dev environment

Prerequisites

  • git, any version
  • Node.js >=20.3.0
  • NPM >=9.6.7

Setting up

If you use nvm, running following command inside this repository will automatically pick the right Node.js version for you:

 $ nvm use

Setup steps

  1. git clone https://github.com/swagger-api/swagger-js.git
  2. cd swagger-js
  3. npm install
  4. npm run build
  5. npm run test

Testing with Swagger-UI

It is often the case that after fixing a bug or implementing a new feature, developer wants to test his changes in Swagger-UI. This section will guide you through how to do that.

1. Clone and install swagger-ui repository

You'll find complete information about how to do that in swagger-ui Setting up documentation.

2. Clone and install swagger-js repository

You'll find complete information about how to do that in Steps section of this document.

3. Link repositories using npm link

 $ cd /path/to/swagger-js
 $ npm run build
 $ npm link
 $ cd /path/to/swagger-ui
 $ npm link swagger-client

4. Make sure npm install is not running

Open /path/to/swagger-ui/package.json in your favorite editor and look for "predev": "npm install" script. Temporarily delete this line.

 $ cd /path/to/swagger-ui
 $ npm run dev

You're now running your version of swagger-client inside swagger-ui. Test what you need and continue with following step.

5. Unlink repositories

We have to clean up after we're done. Open /path/to/swagger-ui/package.json in your favorite editor and return back the "predev": "npm install" script.

 $ cd /path/to/swagger-ui
 $ npm unlink --no-save swagger-client
 $ npm install
 $ cd /path/to/swagger-js
 $ npm unlink