Installations
npm install @pakholeung37/openapi-typescript-codegen
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
16.19.1
NPM Version
8.19.3
Score
68.4
Supply Chain
98
Quality
74.8
Maintenance
100
Vulnerability
99.6
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (83.69%)
Handlebars (13.89%)
JavaScript (2.33%)
HTML (0.04%)
Dockerfile (0.04%)
Developer
ferdikoomen
Download Statistics
Total Downloads
356
Last Day
1
Last Week
4
Last Month
10
Last Year
53
GitHub Statistics
3,049 Stars
2,711 Commits
532 Forks
15 Watching
6 Branches
51 Contributors
Bundle Size
306.56 kB
Minified
58.46 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.24.0
Package Id
@pakholeung37/openapi-typescript-codegen@0.24.0
Unpacked Size
225.02 kB
Size
33.24 kB
File Count
6
NPM Version
8.19.3
Node Version
16.19.1
Publised On
06 May 2023
Total Downloads
Cumulative downloads
Total Downloads
356
Last day
0%
1
Compared to previous day
Last week
100%
4
Compared to previous week
Last month
900%
10
Compared to previous month
Last year
-82.5%
53
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
53
OpenAPI Typescript Codegen
Node.js library that generates Typescript clients based on the OpenAPI specification.
Why?
- Frontend ❤️ OpenAPI, but we do not want to use JAVA codegen in our builds
- Quick, lightweight, robust and framework-agnostic 🚀
- Supports generation of TypeScript clients
- Supports generations of Fetch, Node-Fetch, Axios, Angular and XHR http clients
- Supports OpenAPI specification v2.0 and v3.0
- Supports JSON and YAML files for input
- Supports generation through CLI, Node.js and NPX
- Supports tsc and @babel/plugin-transform-typescript
- Supports aborting of requests (cancelable promise pattern)
- Supports external references using json-schema-ref-parser
Install
npm install openapi-typescript-codegen --save-dev
Usage
$ openapi --help
Usage: openapi [options]
Options:
-V, --version output the version number
-i, --input <value> OpenAPI specification, can be a path, url or string content (required)
-o, --output <value> Output directory (required)
-c, --client <value> HTTP client to generate [fetch, xhr, node, axios, angular] (default: "fetch")
--name <value> Custom client class name
--useOptions Use options instead of arguments
--useUnionTypes Use union types instead of enums
--exportCore <value> Write core files to disk (default: true)
--exportServices <value> Write services to disk (default: true)
--exportModels <value> Write models to disk (default: true)
--exportSchemas <value> Write schemas to disk (default: false)
--indent <value> Indentation options [4, 2, tab] (default: "4")
--postfixServices Service name postfix (default: "Service")
--postfixModels Model name postfix
--request <value> Path to custom request file
-h, --help display help for command
Examples
$ openapi --input ./spec.json --output ./generated
$ openapi --input ./spec.json --output ./generated --client xhr
Docker usage
To build the Docker container, execute the following command:
docker build . --tag openapi-typescript-codegen
After this is done, you can execute the CLI commands:
docker run openapi-typescript-codegen --help
docker run openapi-typescript-codegen --input sample.yaml --output client
Documentation
- Basic usage
- OpenAPI object
- Client instances
--name
- Argument vs. Object style
--useOptions
- Enums vs. Union types
--useUnionTypes
- Runtime schemas
--exportSchemas
- Enum with custom names and descriptions
- Nullable props (OpenAPI v2)
- Authorization
- External references
- Canceling requests
- Custom request file
Support
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
SAST tool is run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Info: all commits (28) are checked with a SAST tool
Reason
5 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 6
Reason
5 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6
Reason
Found 0/2 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:17
- Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:16
- Warn: topLevel 'contents' permission set to 'write': .github/workflows/auto-merge.yml:7
- Warn: no topLevel permission defined: .github/workflows/codeql.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/auto-merge.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/ferdikoomen/openapi-typescript-codegen/auto-merge.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/ferdikoomen/openapi-typescript-codegen/codeql.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/ferdikoomen/openapi-typescript-codegen/codeql.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/ferdikoomen/openapi-typescript-codegen/codeql.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/ferdikoomen/openapi-typescript-codegen/codeql.yml/main?enable=pin
- Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating node:alpine to node:alpine@sha256:70eca392e3d52cb7d133b52d52e8600d8c410a5eaee6105c11324b28868f9ac9
- Warn: npmCommand not pinned by hash: Dockerfile:4
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 containerImage dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Score
4.2
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More