Socket
Socket
Sign inDemoInstall

openapi-typescript-codegen

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-typescript-codegen

Library that generates Typescript clients based on the OpenAPI specification.


Version published
Weekly downloads
235K
increased by1.57%
Maintainers
1
Weekly downloads
 
Created

What is openapi-typescript-codegen?

The openapi-typescript-codegen npm package is a tool that generates TypeScript clients from OpenAPI specifications. It helps developers to create strongly-typed API clients, ensuring type safety and reducing the likelihood of runtime errors.

What are openapi-typescript-codegen's main functionalities?

Generate TypeScript Client

This feature allows you to generate a TypeScript client from an OpenAPI specification file. The generated client will include all the necessary types and methods to interact with the API.

const { generate } = require('openapi-typescript-codegen');

generate({
  input: './path/to/openapi.yaml',
  output: './generated',
  clientName: 'MyApiClient'
});

Custom Templates

This feature allows you to use custom templates for generating the TypeScript client. This can be useful if you need to adhere to specific coding standards or want to customize the generated code.

const { generate } = require('openapi-typescript-codegen');

generate({
  input: './path/to/openapi.yaml',
  output: './generated',
  templates: './path/to/custom/templates'
});

Generate Models Only

This feature allows you to generate only the TypeScript models from an OpenAPI specification file. This can be useful if you only need the type definitions and not the full client.

const { generate } = require('openapi-typescript-codegen');

generate({
  input: './path/to/openapi.yaml',
  output: './generated/models',
  onlyModels: true
});

Other packages similar to openapi-typescript-codegen

Keywords

FAQs

Package last updated on 07 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc