Migration from Swagger
Outline
npx @nestia/migrate
@nestia/migrate
converts swagger.json
file to:
- NestJS Project
- Standalone SDK Library
- Standalone Mockup Simulator
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.
Left is NestJS server code, and right is client (frontend) code utilizing SDK
Arguments
# 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.
Put your
swagger.json
file, then "TypeScript Swagger Editor" be opened.
- Concepts
- SDK: collection of typed
fetch
functions with DTO structures - Mockup Simulator: embedded backend simulator in the SDK
- SDK: collection of typed
- Demo Editors
- BBS (Bullet-in Board System): NestJS Project / SDK & Simulator
- Shopping Mall: NestJS Project / SDK & Simulator
- Clickhouse: NestJS Project / SDK & Simulator
- Fireblocks: NestJS Project / SDK & Simulator
- Uber: NestJS Project / SDK & Simulator
- OpenAI: NestJS Project / SDK & Simulator