đź“– Guide DocumentsMigration from Swagger

Migration from Swagger

Outline

Terminal
npx @nestia/migrate

@nestia/migrate converts swagger.json file to:

When you run npx @nestia/migrate command, @nestia/migrate will analyze your swagger.json file, and generate a NestJS project into the output direcory. If you’re considering to migrate your backend project to NestJS, @nestia/migrate will be a good starting point.

Of course, even if you’re not considering to adapt NestJS, you can generate standalone SDK library and Mockup Simulator from the swagger.json file instead. Just run the npx @nestia/migrate command and build the SDK library and Mockup Simulator, then frontend (client) developers may get satisfied.

SDK

Left is NestJS server code, and right is client (frontend) code utilizing SDK

Arguments

Terminal
# GRAMMER
npx @nestia/migrate 
  --mode [nest|sdk] 
  --input [input] 
  --output [output] 
  --package [name]
  --simulate [true|false]
  --e2e [true|false]
 
# EXAMPLES
npx @nestia/migrate --mode nest --input swagger.json --output directory --package @samchon/bbs --simulate false --e2e false
npx @nestia/migrate --mode sdk --input swagger.json --output directory --package @samchon/bbs --simulate true --e2e true

You can specify migration options like above.

However, don’t worry anything. If you omit something, prompt inquiries will help you.

npx @nestia/migrate
? Migration mode (Use arrow keys):
  > NestJS
    SDK
? Swagger file location: assets/input/clickhouse.json
? Package name: @samchon/bbs
? Output directory path: assets/output/clickhouse-sdk-manual
? Mokup Simulator: true
? E2E Test Functions: true

Cloud Editor

You can test @nestia/migrate on the web browser.

Visit TypeScript Swagger Editor and upload your swagger.json file.

Then, you can test the migrated NestJS Project, SDK library and Mockup Simulator in the web browser.

Swagger file uploader
Placeholder image
orto select swagger.json/yaml file



Generate Editor

Put your swagger.json file, then “TypeScript Swagger Editor” be opened.

Example Case