I've found a solution to generate a client API for Angular 2 TypeScript without java command but using node command.

Example node script to generate typescript angular client from swagger.yaml. Note that we use http. Request cannot verify the first certificate if using https (at the time of writing this)

This is app.js

var fs = require('fs');
var path = require('path');
var jsYaml = require('js-yaml');
var request = require('request');
var unzip = require('unzip2');

var codeGenEndpoint = 'http://generator.swagger.io/api/gen/clients';
var language = 'typescript-angular2';

fs.readFile(path.resolve('swagger.yaml'), 'utf8', function (error, yaml) {
    if (error) {
        throw error;
    }

    var swaggerObj = jsYaml.load(yaml);

    var postBody = {
        spec: swaggerObj,
        options: {
            modelPropertyNaming: 'camelCase',
            apiPackage: 'api.clients.settings',
            modelPackage: 'api.clients.settings'
        }
    };

    request.post({
        url: codeGenEndpoint + '/' + language,
        body: JSON.stringify(postBody),
        headers: {
            'Content-Type': 'application/json'
        }
    }, function(error, response, body){
        if (error) {
            throw error;
        }

        if (response.statusCode !== 200) {
            throw new Error('Response code was not 200. ' + body)
        }

        var responseObj = JSON.parse(body);

        request({
            url: responseObj.link,
            encoding: null
        }).pipe(unzip.Extract({ path: 'src/client/js/codegen/settingsApi'}));
    });
});

I just set variable language to 'typescript-angular2'. After that node app.js

For the list of available client languages just visit http://generator.swagger.io/api/gen/clients

And for more details: https://github.com/swagger-api/swagger-codegen/wiki/FAQ section Generator Service

Answer from mahdi kallel on Stack Overflow
🌐
npm
npmjs.com › package › swagger-codegen
swagger-codegen - npm
Code generation for Swagger based API's.. Latest version: 0.1.1, last published: 10 years ago. Start using swagger-codegen in your project by running `npm i swagger-codegen`. There are 3 other projects in the npm registry using swagger-codegen.
      » npm install swagger-codegen
    
Published   May 02, 2016
Version   0.1.1
Author   Steve Gray
🌐
npm
npmjs.com › package › swagger-js-codegen
swagger-js-codegen - npm
A Swagger codegen for JavaScript. Latest version: 1.13.0, last published: 6 years ago. Start using swagger-js-codegen in your project by running `npm i swagger-js-codegen`. There are 24 other projects in the npm registry using swagger-js-codegen.
      » npm install swagger-js-codegen
    
Published   Sep 18, 2019
Version   1.13.0
Author   William Candillon
🌐
npm
npmjs.com › package › swagger-typescript-codegen
swagger-typescript-codegen - npm
This package generates a TypeScript class from a swagger specification file. The code is generated using mustache templates and is quality checked by jshint and beautified by js-beautify.
      » npm install swagger-typescript-codegen
    
Published   Sep 28, 2021
Version   3.2.4
Author   Marius Tennøe
🌐
Swagger
swagger.io › docs › open-source-tools › swagger-codegen › codegen-v3 › about
Swagger Codegen | Swagger Docs
npm install · 3 · node . Which launches a node.js server so the AJAX calls have a place to go. It’s possible to leverage Swagger Codegen directly within your preferred CI/CD workflows to streamline your auto-generation requirements. Check out the workflows integration guide to see information on our Maven, Gradle, and GitHub integration options.
Top answer
1 of 2
2

I've found a solution to generate a client API for Angular 2 TypeScript without java command but using node command.

Example node script to generate typescript angular client from swagger.yaml. Note that we use http. Request cannot verify the first certificate if using https (at the time of writing this)

This is app.js

var fs = require('fs');
var path = require('path');
var jsYaml = require('js-yaml');
var request = require('request');
var unzip = require('unzip2');

var codeGenEndpoint = 'http://generator.swagger.io/api/gen/clients';
var language = 'typescript-angular2';

fs.readFile(path.resolve('swagger.yaml'), 'utf8', function (error, yaml) {
    if (error) {
        throw error;
    }

    var swaggerObj = jsYaml.load(yaml);

    var postBody = {
        spec: swaggerObj,
        options: {
            modelPropertyNaming: 'camelCase',
            apiPackage: 'api.clients.settings',
            modelPackage: 'api.clients.settings'
        }
    };

    request.post({
        url: codeGenEndpoint + '/' + language,
        body: JSON.stringify(postBody),
        headers: {
            'Content-Type': 'application/json'
        }
    }, function(error, response, body){
        if (error) {
            throw error;
        }

        if (response.statusCode !== 200) {
            throw new Error('Response code was not 200. ' + body)
        }

        var responseObj = JSON.parse(body);

        request({
            url: responseObj.link,
            encoding: null
        }).pipe(unzip.Extract({ path: 'src/client/js/codegen/settingsApi'}));
    });
});

I just set variable language to 'typescript-angular2'. After that node app.js

For the list of available client languages just visit http://generator.swagger.io/api/gen/clients

And for more details: https://github.com/swagger-api/swagger-codegen/wiki/FAQ section Generator Service

2 of 2
1

Are you looking for something like this?

npm install @openapitools/openapi-generator-cli -g
🌐
npm
npmjs.com › package › swagger-node-codegen
swagger-node-codegen - npm
Latest version: 1.6.3, last published: 7 years ago. Start using swagger-node-codegen in your project by running `npm i swagger-node-codegen`. There are 3 other projects in the npm registry using swagger-node-codegen.
      » npm install swagger-node-codegen
    
Published   Apr 23, 2019
Version   1.6.3
Author   Fran Méndez
🌐
GitHub
github.com › swagger-api › swagger-codegen
GitHub - swagger-api/swagger-codegen: swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition. · GitHub
cd samples/dynamic-html/ npm install node . Which launches a node.js server so the AJAX calls have a place to go. To do so, just use the -l html flag when reading a spec file. This creates a single, simple HTML file with embedded css so you ...
Starred by 17.7K users
Forked by 6K users
Languages   Mustache 53.0% | Java 37.9% | Shell 5.1% | TypeScript 1.3% | Batchfile 0.6% | Apex 0.3%
🌐
GitHub
github.com › wcandillon › swagger-js-codegen
GitHub - wcandillon/swagger-js-codegen: A Swagger Codegen for typescript, nodejs & angularjs
This package generates a nodejs, reactjs or angularjs class from a swagger specification file. The code is generated using mustache templates and is quality checked by jshint and beautified by js-beautify.
Starred by 691 users
Forked by 285 users
Languages   HTML 55.7% | JavaScript 44.3% | HTML 55.7% | JavaScript 44.3%
🌐
npm
npmjs.com › package › swagger-nodegen-cli
swagger-nodegen-cli - npm
April 24, 2022 - A simple convenience package that wraps the swagger-codegen-cli for the node/npm environment.. Latest version: 3.0.34, last published: 4 years ago. Start using swagger-nodegen-cli in your project by running `npm i swagger-nodegen-cli`. There ...
      » npm install swagger-nodegen-cli
    
Published   Apr 24, 2022
Version   3.0.34
Author   sius
Find elsewhere
🌐
npm
npmjs.com › package › swagger-axios-codegen
swagger-axios-codegen - npm
March 16, 2026 - const { codegen } = require('swagger-axios-codegen') codegen({ methodNameMode: 'operationId', source: require('./swagger.json') })
      » npm install swagger-axios-codegen
    
Published   Jan 29, 2026
Version   0.18.0
Author   Manwei Leung
🌐
npm
npmjs.com › search
keywords:swagger-codegen - npm search
ES6 Template-set for swagger-codegen that generates much of the code required for a server-side solution.
🌐
GitHub
github.com › fmvilas › swagger-node-codegen
GitHub - fmvilas/swagger-node-codegen: An OpenAPI 3.x/Swagger 2 code generator for Node.js
npm install -g swagger-node-codegen · To use it as a module in your project: npm install --save swagger-node-codegen ·
Starred by 199 users
Forked by 54 users
Languages   JavaScript 100.0% | JavaScript 100.0%
🌐
npm
npmjs.com › package › swagger-code-generate
swagger-code-generate - npm
November 9, 2022 - Latest version: 2.3.1, last published: 3 years ago. Start using swagger-code-generate in your project by running `npm i swagger-code-generate`. There are no other projects in the npm registry using swagger-code-generate.
      » npm install swagger-code-generate
    
Published   Nov 09, 2022
Version   2.3.1
Author   fisher
🌐
npm
npmjs.com › package › swagger-codegen-openapi
swagger-codegen-openapi - npm
April 28, 2021 - A code generator based on openapi generator. Latest version: 1.0.7, last published: 5 years ago. Start using swagger-codegen-openapi in your project by running `npm i swagger-codegen-openapi`. There are no other projects in the npm registry ...
      » npm install swagger-codegen-openapi
    
Published   Apr 28, 2021
Version   1.0.7
Author   Kher Phay Chang
🌐
npm
npmjs.com › package › small-swagger-codegen
small-swagger-codegen - npm
December 13, 2020 - A small version of swagger-codegen. Does fewer things with less code.. Latest version: 1.29.2, last published: 3 years ago. Start using small-swagger-codegen in your project by running `npm i small-swagger-codegen`. There are no other projects in the npm registry using small-swagger-codegen.
      » npm install small-swagger-codegen
    
Published   May 03, 2023
Version   1.29.2
Author   GasBuddy
🌐
npm
npmjs.com › package › swagger-codegen-cli
swagger-codegen-cli - npm
July 25, 2017 - Latest version: 2.2.3, last published: 9 years ago. Start using swagger-codegen-cli in your project by running `npm i swagger-codegen-cli`. There are 1 other projects in the npm registry using swagger-codegen-cli.
      » npm install swagger-codegen-cli
    
Published   Jul 25, 2017
Version   2.2.3
Author   yobryon
🌐
npm
npmjs.com › package › codegen-swagger-express
codegen-swagger-express - npm
January 22, 2021 - Latest version: 1.0.1, last published: 5 years ago. Start using codegen-swagger-express in your project by running `npm i codegen-swagger-express`. There are no other projects in the npm registry using codegen-swagger-express.
      » npm install codegen-swagger-express
    
Published   Jan 22, 2021
Version   1.0.1
Author   AndreOneti
🌐
npm
npmjs.com › package › openapi-codegen
openapi-codegen - npm
August 24, 2021 - Node.js-based codegen for OpenAPI documents. This project was initially a 24-hour hackathon. The local model adaptor code is entirely original and has been reverse-engineered from the existing documentation and template usage. ... Supports OpenAPI 3.0.x natively, and Swagger/OpenAPI 1.2 and 2.0 by internal conversion.
      » npm install openapi-codegen
    
Published   Aug 24, 2021
Version   2.2.2
🌐
npm
npmjs.com › package › gulp-swagger-codegen
gulp-swagger-codegen - npm
May 8, 2016 - Flexible code generation for Swagger projects, targets ES6+.. Latest version: 2.0.3, last published: 9 years ago. Start using gulp-swagger-codegen in your project by running `npm i gulp-swagger-codegen`. There are no other projects in the npm ...
      » npm install gulp-swagger-codegen
    
Published   May 08, 2016
Version   2.0.3
Author   Steve Gray
🌐
npm
npmjs.com › package › swagger-code-gen-liquid
swagger-code-gen-liquid - npm
September 28, 2022 - const { codegen } = require('swagger-code-gen-liquid') codegen({ remoteUrl: 'http://localhost:44353/swagger/v1/swagger.json', // your swagger json url, v2.0 or 3.0+. definitionTemplateFile: 'definitions.liquid', // your swagger schema definition ...
      » npm install swagger-code-gen-liquid
    
Published   Sep 28, 2022
Version   1.0.22
Author   yuzhigang