Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-typescript-api

Package Overview
Dependencies
Maintainers
2
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-typescript-api

Generate the API client for Fetch or Axios from an OpenAPI Specification

  • 13.0.23
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
227K
increased by1.74%
Maintainers
2
Weekly downloads
 
Created

What is swagger-typescript-api?

The swagger-typescript-api npm package is a tool that generates TypeScript API client code from Swagger/OpenAPI definitions. It helps developers to create strongly-typed API clients, reducing the risk of runtime errors and improving the development experience.

What are swagger-typescript-api's main functionalities?

Generate TypeScript API Client

This feature allows you to generate a TypeScript API client from a Swagger/OpenAPI definition. The `generateApi` function takes an object with configuration options such as the name of the output file, the URL of the Swagger definition, and the output directory.

const { generateApi } = require('swagger-typescript-api');

generateApi({
  name: 'MyApi.ts',
  url: 'http://api.example.com/swagger.json',
  output: './src/api',
});

Custom Templates

This feature allows you to use custom templates for generating the TypeScript API client. By specifying the `templates` option, you can provide a path to your custom templates, giving you full control over the generated code's structure and style.

const { generateApi } = require('swagger-typescript-api');

generateApi({
  name: 'MyApi.ts',
  url: 'http://api.example.com/swagger.json',
  output: './src/api',
  templates: './my-custom-templates',
});

Generate API Client from Local File

This feature allows you to generate a TypeScript API client from a local Swagger/OpenAPI definition file. The `input` option specifies the path to the local Swagger file.

const { generateApi } = require('swagger-typescript-api');

generateApi({
  name: 'MyApi.ts',
  input: './swagger.json',
  output: './src/api',
});

Other packages similar to swagger-typescript-api

FAQs

Package last updated on 13 Nov 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