Skip to content

Commit

Permalink
Merge pull request #90 from lux-group/route-options-tsdoc
Browse files Browse the repository at this point in the history
Add tsdoc comments to `RouteOptions`
  • Loading branch information
eddiemcleanlux authored Aug 22, 2023
2 parents e3e4614 + 94be38f commit d724e19
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,40 @@ declare module "@luxuryescapes/router" {
}

interface RouteOptions {
/**
* Path for the route
* @see https://expressjs.com/en/4x/api.html#path-examples
*/
url: string;
/** The route will be referenced by this ID in the contract */
operationId?: string;
/** Request and response schemas. The endpoint will use these to validate incoming requests and outgoing responses. */
schema?: RouteSchema;
/**
* If `false`, the Swagger docs will specify that a cookie containing an access token is required.
* @defaultValue `false`
*/
isPublic?: boolean;
/** Pre-handlers are run before request validation. Usually used for authentication. */
preHandlers?: ExpressHandler[];
/** Handlers are run after request validation. */
handlers: ((req: any, res: Response, next: NextFunction) => void)[]
/** For Swagger docs */
tags?: string[];
/** For Swagger docs */
summary?: string;
/** For Swagger docs */
description?: string;
/**
* If `true`, logs a warning on request validation error.
* @defaultValue `false`
*/
warnOnRequestValidationError?: boolean;
/**
* Options to be passed to `express.json()`
* @see https://expressjs.com/en/4x/api.html#express.json
* @defaultValue `{}`
*/
jsonOptions?: { [option: string]: string | number | boolean | null | undefined };
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@luxuryescapes/router",
"version": "2.5.26",
"version": "2.5.27",
"description": "Wrapper around express router that provides validation and documentation out of the box",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit d724e19

Please sign in to comment.