MCPcopy
hub / github.com/lukeautry/tsoa

github.com/lukeautry/tsoa @v7.0.0-alpha.0 sqlite

repository ↗ · DeepWiki ↗ · release v7.0.0-alpha.0 ↗
1,400 symbols 3,313 edges 241 files 16 documented · 1%
README

tsoa

Pronounced so·uh

OpenAPI-compliant REST APIs using TypeScript and Node

build status npm version

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.

Extension points exported contracts — how you extend this code

IocContainer (Interface)
(no doc) [2 implementers]
packages/runtime/src/interfaces/iocModule.ts
DeprecatedType (Interface)
@deprecated
tests/fixtures/testModel31.ts
ExtendedSpecConfig (Interface)
(no doc)
packages/cli/src/cli.ts
SpecAndName (Interface)
(no doc)
tests/unit/swagger/parameterDetails3.spec.ts
Exception (Interface)
(no doc) [1 implementers]
packages/runtime/src/routeGeneration/templateHelpers.ts
GetterInterface (Interface)
(no doc) [2 implementers]
tests/fixtures/testModel31.ts
ExtendedRoutesConfig (Interface)
(no doc)
packages/cli/src/cli.ts
SpecAndName (Interface)
(no doc)
tests/unit/swagger/schemaDetails3.spec.ts

Core symbols most depended-on inside this repo

verifyGetRequest
called by 295
tests/integration/utils.ts
Get
called by 199
packages/runtime/src/decorators/methods.ts
GetSpec
called by 175
packages/cli/src/swagger/specGenerator3.ts
Generate
called by 157
packages/cli/src/metadataGeneration/methodGenerator.ts
getDefaultExtendedOptions
called by 138
tests/fixtures/defaultOptions.ts
resolve
called by 128
packages/cli/src/metadataGeneration/typeResolver.ts
verifyPostRequest
called by 117
tests/integration/utils.ts
Post
called by 91
packages/runtime/src/decorators/methods.ts

Shape

Method 602
Class 266
Interface 265
Function 244
Enum 23

Languages

TypeScript100%

Modules by API surface

tests/fixtures/testModel.ts88 symbols
tests/fixtures/testModel31.ts87 symbols
packages/runtime/src/swagger/swagger.ts52 symbols
tests/fixtures/controllers/getController.ts50 symbols
packages/runtime/src/routeGeneration/templateHelpers.ts44 symbols
packages/cli/src/metadataGeneration/typeResolver.ts44 symbols
packages/runtime/src/metadataGeneration/tsoa.ts39 symbols
tests/fixtures/controllers/parameterController.ts32 symbols
tests/fixtures/controllers/validationTestController.ts31 symbols
packages/cli/src/swagger/specGenerator3.ts30 symbols
packages/cli/src/metadataGeneration/parameterGenerator.ts27 symbols
tests/fixtures/controllers/postController31.ts26 symbols

Dependencies from manifests, versioned

@hapi/boom10.0.1 · 1×
@hapi/hapi21.3.12 · 1×
@koa/multer3.0.2 · 1×
@koa/router13.1.0 · 1×
@tsoa/cli7.0.0-alpha.0 · 1×
@tsoa/runtime7.0.0-alpha.0 · 1×
@types/body-parser1.19.5 · 1×
@types/chai4.3.19 · 1×
@types/chai-as-promised8.0.1 · 1×
@types/express5.0.3 · 1×
@types/glob8.1.0 · 1×
@types/koa2.15.0 · 1×

For agents

$ claude mcp add tsoa \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact