🌐
GitHub
github.com › acacode › swagger-typescript-api
GitHub - acacode/swagger-typescript-api: Generate the API Client for Fetch or Axios from an OpenAPI Specification · GitHub
import * as path from "node:path"; import * as process from "node:process"; import { generateApi } from "swagger-typescript-api"; await generateApi({ input: path.resolve(process.cwd(), "./swagger.json") }); For more detailed configuration options, ...
Starred by 4.1K users
Forked by 427 users
Languages   TypeScript 87.2% | EJS 9.7% | JavaScript 3.1%
🌐
npm
npmjs.com › package › swagger-typescript-api
swagger-typescript-api - npm
2 weeks ago - import * as path from "node:path"; import * as process from "node:process"; import { generateApi } from "swagger-typescript-api"; await generateApi({ input: path.resolve(process.cwd(), "./swagger.json") }); For more detailed configuration options, ...
      » npm install swagger-typescript-api
    
Published   Apr 16, 2026
Version   13.6.10
Discussions

node.js - How to generate swagger API doc from TypeScript based Express app? - Stack Overflow
I am able to configure swagger url using the Express API with autogenerated OpenAPI doc through Swagger article. I am using TypeScript and it generates .js files under dist which does not have any API doc comments added. Pointing apis: ['../dist/*.js'] nor to Route.ts generates the API details. More on stackoverflow.com
🌐 stackoverflow.com
How to generate basic TypeScript interfaces from Swagger schema? - Stack Overflow
The harder part was setting up the project for schema generation, because annotations and other factors have to meet Swagger / NSwag expectations. Since that is already done in the example above, NSwagStudio generated TypeScript with one click, and can save the config for automated toolchain use. More on stackoverflow.com
🌐 stackoverflow.com
Any examples of how to use the output from swagger-typescript-api?
One question. Does your swagger json file contains possible exception codes for a given api? If not, then generated sdk will not handle it. More on reddit.com
🌐 r/typescript
3
5
October 2, 2024
Using a TypeScript Configuration File
I want to use a TypeScript configuration file. I used a .js configuration file and it works to generate a model that contains dates, but I couldn't do it using a TypeScript file. Is there a sol... More on github.com
🌐 github.com
0
December 6, 2024
🌐
Medium
medium.com › @sina.alizadeh120 › unlocking-rapid-development-typescript-model-generation-with-swagger-5c184a3c89f4
Unlocking Rapid Development: TypeScript Model Generation with Swagger | by Sina Alizadeh | Medium
January 15, 2024 - npx openapi-merge-cli --config ./swagger/swagger.config.json · This command merges the specified Swagger files into a single output file. Use Swagger-Typescript-API to generate models, payloads, and Axios service calls from the merged Swagger ...
🌐
GitHub
github.com › hosseinmd › swagger-typescript › blob › master › readme.md
swagger-typescript/readme.md at master · hosseinmd/swagger-typescript
Now you can use APIs, So for advanced config read below. ... { "$schema": "https://raw.githubusercontent.com/hosseinmd/swagger-typescript/master/schema/v6.json", "url": "http://example.com/api/swagger.json", "dir": "./services", "prettierPath": ".prettierrc", "language": "typescript" }
Author   hosseinmd
🌐
GitHub
github.com › john-zulhelmi › swagger-typescript-api
GitHub - john-zulhelmi/swagger-typescript-api · GitHub
Usage: sta [options] Usage: swagger-typescript-api [options] Usage: swagger-typescript-api generate-templates [options] Options: -v, --version output the current version -p, --path <string> path/url to swagger scheme -o, --output <string> output path of typescript api file (default: "./") -n, --name <string> name of output typescript api file (default: "Api.ts") -t, --templates <string> path to folder containing templates -d, --default-as-success use "default" response status code as success response too.
Author   john-zulhelmi
🌐
Ts.ED
tsed.dev › tutorials › swagger.html
Swagger | Ts.ED a modern Node.js/Bun.js framework built with TypeScript on top of Express.js/Koa.js/Fastify.js/CLI/AWS
May 21, 2025 - import {Controller} from "@tsed/di"; import {Docs} from "@tsed/swagger"; @Controller("/calendars") @Docs("api-v2") // display this controllers only for api-docs-v2 export class CalendarCtrlV2 {} // OR @Controller("/calendars") @Docs("api-v2", "api-v1") // display this controllers for api-docs-v2 and api-docs-v1 export class CalendarCtrl {} You can use the pathPatterns options to include only controllers whose paths match the pattern list provided. typescript · import {Configuration} from "@tsed/common"; import "@tsed/platform-express"; import "@tsed/swagger"; // import swagger Ts.ED module @C
🌐
npm
npmjs.com › package › swagger-typescript
swagger-typescript - npm
November 19, 2022 - Now you can use APIs, So for advanced config read below. ... { "$schema": "https://raw.githubusercontent.com/hosseinmd/swagger-typescript/master/schema/v6.json", "url": "http://example.com/api/swagger.json", "dir": "./services", "prettierPath": ".prettierrc", "language": "typescript" }
      » npm install swagger-typescript
    
Published   Aug 22, 2025
Version   6.9.3
Author   Hossein mohammadi
🌐
GitHub
github.com › thiagobustamante › typescript-rest-swagger
GitHub - thiagobustamante/typescript-rest-swagger: Swagger tools for typescript-rest
swagger: outputDirectory: ./dist entryFile: - ./controllers/*.ts outputFormat: openapi_3 host: localhost:3000 version: 1.0 name: Typescript-rest Test API description: A description license: MIT basePath: /v1 securityDefinitions: api_key: type: apiKey name: access_token in: query ignore: - /node_modules/**
Starred by 158 users
Forked by 58 users
Languages   TypeScript 95.2% | JavaScript 4.8% | TypeScript 95.2% | JavaScript 4.8%
Find elsewhere
🌐
Medium
medium.com › bb-tutorials-and-thoughts › how-to-add-swagger-to-nodejs-rest-api-typescript-version-5a63953c993b
How To Add Swagger To NodeJS REST API — Typescript Version | by Bhargav Bachina | Bachina Labs | Medium
September 9, 2020 - We need to install types as well since we are implementing a typescript version. npm install swagger-ui-express swagger-jsdoc --save npm install @types/swagger-ui-express @types/swagger-jsdoc --save · You need to define the routes and task files separately as below. Routes contain all the route information and it loads appropriate files based on the path. ... There are two things you need to understand before implementing swagger docs to your REST API.
🌐
Medium
medium.com › @youry.stancatte › generating-typescript-interfaces-from-swagger-1910cc7a726a
Generating Typescript interfaces from Swagger | by Youry Stancato | Medium
January 23, 2023 - These interfaces can be used to define the types used in the API and to ensure that the API is being called correctly in the application. This can save developers time and effort by making sure that the correct types of parameters are passed to the endpoints, and that the correct types of responses are received. To auto generate the interfaces is super easy. You can do it via command line. At this moment the latest openapi-typescript lib only accepts the swagger specification v3 or higher, but you can use the openapi-typescript@5.4.1 to generate interfaces from the version 2
🌐
GitHub
github.com › hunghg255 › swagger-typescript-api-es
GitHub - hunghg255/swagger-typescript-api-es: TypeScript API generator via Swagger scheme
import { defaultConfig } from 'swagger-typescript-api-es'; export default defaultConfig({ name: 'api-axios.ts', output: './src/apis/axios-gentype', url: 'http://localhost:5002/api-json', httpClientType: 'axios', });
Starred by 14 users
Forked by 3 users
Languages   TypeScript 86.7% | EJS 13.3% | TypeScript 86.7% | EJS 13.3%
🌐
Fig
fig.io › manual › swagger-typescript-api
swagger-typescript-api | Fig
swagger-typescript-api · swagger-typescript-api generate-templates · Generate api via swagger scheme · On this page · Subcommands ·
🌐
Reddit
reddit.com › r/typescript › any examples of how to use the output from swagger-typescript-api?
r/typescript on Reddit: Any examples of how to use the output from swagger-typescript-api?
October 2, 2024 -

Lots of examples of how to run the tool to generate a client based on an OpenAPI spec.... but damn'd if I can't find an example of how to use it.

Here's where I'm at (this is in a ReactJS app):

import { Api } from "../../../swaggergen/Api";
import { loginRequest } from "../authConfig";
import { msalInstance } from "../index";

export async function getApiClient() {

    var client = new Api({
        baseUrl: "",
        securityWorker: () => {
            const account = msalInstance.getActiveAccount();
            if (!account) {
                throw Error("No active account! Verify a user has been signed in and setActiveAccount has been called.");
            }
        
            const response = await msalInstance.acquireTokenSilent({
                ...loginRequest,
                account: account
            });
                    
            return {
                headers: {
                    Authorization: `Bearer ${response.accessToken}`
                },
            };
        },
    });
        
    // Halp... how to use client?
    //?     var d = await client.v1.MyFunkyList();
    //?     var r = await d.json();
}

How do I get typed results out of the API? MyFunkyList() on success should returns and instance of MyFunkyData. But danged if I see how?

Also, how do I handle error conditions? For example some POST calls will return 400 bad request with standard JSON message that contains the error details. How do I detect 400; how do I get the JSON data?

The tool's site: https://www.npmjs.com/package/swagger-typescript-api

Thanks a ton!

🌐
DEV Community
dev.to › po5i › how-to-generate-a-typescript-client-from-a-swagger-documented-api-14d8
How to generate a TypeScript client from a Swagger documented API - DEV Community
March 20, 2022 - npx create-react-app react-mini-swagger-client --template typescript · And API client was generated with swagger-typescript-api.
🌐
Stackademic
stackademic.com › blog › how-to-create-api-documentation-fast-swagger-with-typescript-a5926acbed30
How To Create API Documentation (FAST): Swagger With TypeScript | Stackademic
August 20, 2023 - import express from 'express'; import { employeeRouter } from './employee-route'; export const routes = express.Router(); routes.use('/api/employee', employeeRouter); If import *** from *** gives an error, there could be an error in your tsconfig.json file. It is important to give “esModuleInterop” field true and if you already defined this, you can restart your IDE. Next, we define swagger.ts file. ... import swaggerAutogen from 'swagger-autogen'; const doc = { info: { version: 'v1.0.0', title: 'Swagger Demo Project', description: 'Implementation of Swagger with TypeScript' }, servers: [
🌐
DEV Community
dev.to › yugjadvani › automating-nodejs-documentation-with-swagger-3o0d
Automating Node.js Documentation with Swagger - DEV Community
March 3, 2025 - Before integrating Swagger, ensure you have a Node.js project set up with TypeScript. mkdir my-nodejs-project cd my-nodejs-project npm init -y ... This initializes TypeScript and generates a tsconfig.json file.
🌐
GitHub
github.com › acacode › swagger-typescript-api › issues › 1005
Using a TypeScript Configuration File · Issue #1005 · acacode/swagger-typescript-api
December 6, 2024 - If not, is there another way to generate the date type from a string format date and DateTime? the config.js File : const primitiveTypeConstructs = (constructs) => ({ ...constructs, string: { 'date-time': () => 'Date', 'date': () => 'Date', }, }); module.exports = { primitiveTypeConstructs, }; package.json : scripts": { "openapi:generate": "swagger-typescript-api -p ./open-api/open-api.yaml -o ./src/models --custom-config ./open-api/config --no-client" }, No one assigned ·
Author   khaledboubtan