🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@fresha/openapi-codegen-server-nestjs

Package Overview
Dependencies
Maintainers
7
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fresha/openapi-codegen-server-nestjs

OpenAPI code generation for NestJS servers

0.5.0
latest
Source
npm
Version published
Weekly downloads
22
37.5%
Maintainers
7
Weekly downloads
 
Created
Source

@fresha/openapi-codegen-server-nestjs

OpenAPI code generator for NestJS projects.

Installation

If you need to generate source code using CLI tools, it's enough to install @fresha/openapi-codegen.

$ npm install @fresha/openapi-codegen

Usage

This generator is available as server-nestjs command of the fresha-openapi-codegen CLI.

npx fresha-openapi-codegen \
  server-nestjs \
  --input PATH_TO_OPENAPI_SCHEMA_FILE
  --output ROOT_DIR_OF_NESTJS_PROJECT
  --nest-app NAME_OF_NESTJS_SUBAPP
  --json-api

where:

--nest-app is used if your NestJS project uses workspaces This option's value should be one of NestJS applications from your project. If omitted, generator assumes that your NestJS project is in standard mode

--json-api is used to make generator generate the code according to JSON:API specification, including several optimisations

Other options include:

--dry-run which will make the generator to only print what it's being doing, but don't do actual modification

--verbose which will make the generator print more information on the console

Code generation

Code generator tries to generate code compliant with NestJS best practices. This includes:

  • module
  • controllers
  • actions
  • DTO objects, implemented using class-transformer library

Limitations

  • generator may not fully work on update mode, when you have existing controllers and want to modify only parts of them
  • after generating code, you may need to format it using project's settings. Usually it's done by invoking npm run format command

Keywords

OpenAPI

FAQs

Package last updated on 21 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts