Registry / devops / typescript-rest-swagger-plural

typescript-rest-swagger-plural

JSON →
library0.0.40jsnpmunverified

A temporary fork of typescript-rest-swagger (v0.0.40) that adds support for pluralizing endpoints within class/controller inheritance. It generates Swagger/OpenAPI documentation from TypeScript REST APIs built with the typescript-rest framework. The original library is stable but this fork addresses a specific limitation around endpoint naming. It uses decorators like @Tags, @Response, @Example, and @Security to enrich generated specs. No known release cadence; last published in 2019. Differentiators: resolver for pluralization in inherited controllers compared to the base library.

npm install typescript-rest-swagger-plural
INSTALL
IMPORT
SIG · TYPESCRIPT-REST-SW
T
typescript-rest-swagger-plural
devopsjavascriptv0.0.40
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

swaggerGen
import { swaggerGen } from 'typescript-rest-swagger-plural'
const swaggerGen = require('typescript-rest-swagger-plural')
ESM or CJS both work; the library is not ESM-only.
Tags
import { Tags } from 'typescript-rest-swagger-plural'
import { Tags } from 'typescript-rest-swagger'
Tags decorator is re-exported from this fork.
Response
import { Response } from 'typescript-rest-swagger-plural'
Type parameter optional: @Response<string>(200, 'desc')
Example
import { Example } from 'typescript-rest-swagger-plural'
Used to provide example values for responses.

Shows how to configure and run swaggerGen to generate OpenAPI spec from a typescript-rest controller with pluralized endpoint support.

// swaggerConfig.json { "swagger": { "outputDirectory": "./dist", "entryFile": "./src/controllers.ts" } } // terminal npx swaggerGen -c ./swaggerConfig.json // src/controllers.ts import { Path, GET } from 'typescript-rest'; import { Tags } from 'typescript-rest-swagger-plural'; @Path('user') export class UserController { @GET @Tags('Users') getUsers(): string[] { return ['Alice', 'Bob']; } }
Debug
Known issues
deprecatedThis is a temporary fork of typescript-rest-swagger and is no longer maintained. Use the original package or migrate to a more modern alternative like tsoa or @nestjs/swagger.
fix
Switch to typescript-rest-swagger (original) or consider rewriting with tsoa.
affects: >=0.0.0
breakingImporting from 'typescript-rest-swagger' instead of 'typescript-rest-swagger-plural' will not include the pluralization fix and may cause runtime errors if using inherited controllers.
fix
Ensure all imports reference 'typescript-rest-swagger-plural' explicitly.
affects: <0.0.40
gotchaThe swaggerGen command must be invoked with a config file that specifies both 'outputDirectory' and 'entryFile'. Missing these will cause a silent failure or empty output.
fix
Create a valid swaggerConfig.json with both fields.
affects: >=0.0.0
gotchaJSDoc on methods and parameters is used for descriptions in the generated swagger file. Missing JSDoc leads to incomplete documentation.
fix
Add JSDoc comments to all controller methods and parameters.
affects: >=0.0.0
deprecatedPackage has not been updated since 2019 and may have compatibility issues with newer Node.js versions.
fix
Use a more actively maintained tool like tsoa or @nestjs/swagger.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'typescript-rest-swagger'
Importing from the original package instead of the fork, or the package is not installed.
fix
Run 'npm install typescript-rest-swagger-plural' and change imports to 'typescript-rest-swagger-plural'.
swaggerGen: No such file or directory
The entryFile path in swaggerConfig.json does not exist or is relative to the wrong directory.
fix
Use an absolute path or ensure the path is relative to where the command is run.
TypeError: Cannot read property 'name' of undefined
A controller class is missing the @Path decorator or the file export is incorrect.
fix
Ensure every exported controller class has @Path('something') and is properly imported in the entryFile.
Warning: No operations defined in swagger!
No controller methods were found, possibly because the entryFile does not export any classes with @Path decorator.
fix
Check that entryFile exports all controllers and they are decorated with @Path.
Upgrade
Version history
0.0.40latest on npm
Audit
Dependencies
typescript-restrequiredPeer dependency; the library generates swagger docs for typescript-rest controllers
Agent activity
4 hits · last 30 days
node
4
Resources
typescript-rest-swagger-plural — npm install typescript-rest-swagger-plural · libregistry