How to use the tsoa.ValidationService function in tsoa

To help you get started, we’ve selected a few tsoa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lukeautry / ts-app / api / routes.ts View on Github external
/* tslint:disable */
import { Controller, ValidationService, FieldErrors, ValidateError, TsoaRoute } from 'tsoa';
import { WidgetsController } from './controllers/widgets-controller';
import * as express from 'express';

const models: TsoaRoute.Models = {
  "IWidget": {
    "properties": {
      "id": { "dataType": "double", "required": true },
      "label": { "dataType": "string", "required": true },
      "color": { "dataType": "string", "required": true },
    },
  },
};
const validationService = new ValidationService(models);

export function RegisterRoutes(app: express.Express) {
  app.get('/api/widgets',
    function(request: any, response: any, next: any) {
      const args = {
      };

      let validatedArgs: any[] = [];
      try {
        validatedArgs = getValidatedArgs(args, request);
      } catch (err) {
        return next(err);
      }

      const controller = new WidgetsController();

tsoa

Build swagger-compliant REST APIs using TypeScript and Node

MIT
Latest version published 14 days ago

Package Health Score

95 / 100
Full package analysis