Build OpenAPI-compliant REST APIs using TypeScript and Node
Installations
npm install @tsoa/runtime
Developer
lukeautry
Developer Guide
Module System
CommonJS
Min. Node Version
>=18.0.0
Typescript Support
No
Node Version
22.9.0
NPM Version
lerna/8.1.8/node@v22.9.0+x64 (linux)
Statistics
3,595 Stars
1,904 Commits
503 Forks
28 Watching
27 Branches
173 Contributors
Updated on 28 Nov 2024
Languages
TypeScript (96.53%)
Handlebars (2.24%)
JavaScript (1.23%)
Total Downloads
Cumulative downloads
Total Downloads
21,163,150
Last day
2%
45,104
Compared to previous day
Last week
-3.7%
219,503
Compared to previous week
Last month
18.1%
957,553
Compared to previous month
Last year
31.3%
8,560,693
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
3
Goal
- TypeScript controllers and models as the single source of truth for your API
- A valid OpenAPI (formerly Swagger) spec (2.0 or 3.0 if you choose 😍) is generated from your controllers and models, including:
- Paths (e.g. GET /users)
- Definitions based on TypeScript interfaces (models)
- Parameters/model properties marked as required or optional based on TypeScript (e.g. myProperty?: string is optional in the OpenAPI spec)
- jsDoc supported for object descriptions (most other metadata can be inferred from TypeScript types)
- Routes are generated for middleware of choice
- Express, Hapi, and Koa currently supported, other middleware can be supported using a simple handlebars template
- Validate request payloads
Philosophy
- Rely on TypeScript type annotations to generate API metadata if possible
- If regular type annotations aren't an appropriate way to express metadata, use decorators
- Use jsdoc for pure text metadata (e.g. endpoint descriptions)
- Minimize boilerplate
- Models are best represented by interfaces (pure data structures), but can also be represented by classes
- Runtime validation of tsoa should behave as closely as possible to the specifications that the generated OpenAPI 2/3 schema describes. Any differences in validation logic are clarified by logging warnings during the generation of the OpenAPI Specification (OAS) and/or the routes.
- Please note that by enabling OpenAPI 3 you minimize the chances of divergent validation logic since OpenAPI 3 has a more expressive schema syntax.
Getting Started
Examples
Check out the guides
See example controllers in the tests
See example models in the tests
Help wanted
Contributing code
To contribute (via a PR), please first see the Contributing Guide
Becoming a maintainer
tsoa wants additional maintainers! The library has increased in popularity and has quite a lot of pull requests and issues. Please post in this issue if you're willing to take on the role of a maintainer.
No vulnerabilities found.
Reason
30 commit(s) and 10 issue activity found in the last 90 days -- score normalized to 10
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
security policy file detected
Details
- Info: security policy file detected: SECURITY.md:1
- Info: Found linked content: SECURITY.md:1
- Warn: One or no descriptive hints of disclosure, vulnerability, and/or timelines in security policy
- Info: Found text in security policy: SECURITY.md:1
Reason
3 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
Reason
Found 8/14 approved changesets -- score normalized to 5
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/closeStaleIssuesAndPRs.yml:1
- Warn: no topLevel permission defined: .github/workflows/runTestsOnPush.yml:1
- Warn: no topLevel permission defined: .github/workflows/welcome-first-time-contributors.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/closeStaleIssuesAndPRs.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeautry/tsoa/closeStaleIssuesAndPRs.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/runTestsOnPush.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeautry/tsoa/runTestsOnPush.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/runTestsOnPush.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeautry/tsoa/runTestsOnPush.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/runTestsOnPush.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeautry/tsoa/runTestsOnPush.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/welcome-first-time-contributors.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeautry/tsoa/welcome-first-time-contributors.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/runTestsOnPush.yml:24
- 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 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 26 are checked with a SAST tool
Score
5.1
/10
Last Scanned on 2024-11-18
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 MoreOther packages similar to @tsoa/runtime
@namecheap/tsoa-runtime
Build swagger-compliant REST APIs using TypeScript and Node
tsoa
Build swagger-compliant REST APIs using TypeScript and Node
@tsoa/cli
Build swagger-compliant REST APIs using TypeScript and Node
@taring/tsoa-runtime
Build swagger-compliant REST APIs using TypeScript and Node