Skip to content

Commit

Permalink
add typedefs to call-signature
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmine DiMascio committed Nov 2, 2019
1 parent 7639d7f commit ba69db6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ono from 'ono';
import * as _ from 'lodash';
import * as middlewares from './middlewares';
import { Application, Response, NextFunction } from 'express';
import { OpenApiContext } from './framework/openapi.context';
import {
Expand All @@ -8,7 +9,6 @@ import {
OpenApiRequest,
OpenApiRequestHandler,
} from './framework/types';
import * as middlewares from './middlewares';

export class OpenApiValidator {
private app: Application;
Expand All @@ -35,7 +35,7 @@ export class OpenApiValidator {
});
}

install(app: Application) {
install(app: Application): void {
this.app = app;
this.installPathParams();
this.installMetadataMiddleware();
Expand All @@ -55,7 +55,7 @@ export class OpenApiValidator {
}
}

private installPathParams() {
private installPathParams(): void {
const pathParams = [];
for (const route of this.context.routes) {
if (route.pathParams.length > 0) {
Expand Down Expand Up @@ -84,23 +84,23 @@ export class OpenApiValidator {
}
}

private installMetadataMiddleware() {
private installMetadataMiddleware(): void {
this.app.use(middlewares.applyOpenApiMetadata(this.context));
}

private installMultipartMiddleware() {
private installMultipartMiddleware(): void {
this.app.use(middlewares.multipart(this.context, this.options.multerOpts));
}

private installSecurityMiddleware() {
private installSecurityMiddleware(): void {
const securityMiddleware = middlewares.security(
this.context,
this.options.securityHandlers,
);
this.app.use(securityMiddleware);
}

private installRequestValidationMiddleware() {
private installRequestValidationMiddleware(): void {
const { coerceTypes, unknownFormats } = this.options;
const requestValidator = new middlewares.RequestValidator(
this.context.apiDoc,
Expand All @@ -118,7 +118,7 @@ export class OpenApiValidator {
this.app.use(requestValidationHandler);
}

private installResponseValidationMiddleware() {
private installResponseValidationMiddleware(): void {
const { coerceTypes, unknownFormats, validateResponses } = this.options;
const { removeAdditional } = <ValidateResponseOpts>validateResponses;

Expand Down

0 comments on commit ba69db6

Please sign in to comment.