Change export type and tslint rules

This commit is contained in:
d.rogozhny@gmail.com
2018-06-25 09:14:45 +03:00
parent aae9af48bd
commit 6dd05620c1
3 changed files with 26 additions and 23 deletions
+12 -10
View File
@@ -7,11 +7,11 @@
import { RequestHandler } from "express";
import { ServeStaticOptions } from "serve-static";
declare namespace SwaggerUiExpress {
interface JsonObject { [key: string]: any; }
interface SwaggerUiOptions { [key: string]: any; }
interface SwaggerOptions { [key: string]: any; }
interface JsonObject { [key: string]: any; }
interface SwaggerUiOptions { [key: string]: any; }
interface SwaggerOptions { [key: string]: any; }
interface SwaggerUiExpress {
/**
* Creates a middleware function that returns the pre-generated html file for the Swagger UI page.
*
@@ -24,7 +24,7 @@ declare namespace SwaggerUiExpress {
* @param customeSiteTitle custom title for a page
* @returns an express middleware function that returns the generated html page.
*/
function setup(swaggerDoc?: JsonObject | null,
setup(swaggerDoc?: JsonObject | null,
opts?: SwaggerUiOptions | false | null,
options?: SwaggerOptions,
customCss?: string | false | null,
@@ -38,7 +38,7 @@ declare namespace SwaggerUiExpress {
*
* @returns Express handlers that process requests and return files for Swagger UI.
*/
function serve(): RequestHandler[];
serve(): RequestHandler[];
/**
* Returns handlers for serving Swagger UI files.
@@ -48,7 +48,7 @@ declare namespace SwaggerUiExpress {
* @param options options object that is passed to the express.static middleware.
* @returns Express handlers that process requests and return files for Swagger UI.
*/
function serveWithOptions(options: ServeStaticOptions): RequestHandler[];
serveWithOptions(options: ServeStaticOptions): RequestHandler[];
/**
* Generates the custom html page for the UI API.
@@ -62,7 +62,7 @@ declare namespace SwaggerUiExpress {
* @param customeSiteTitle custom title for a page
* @returns the generated html page.
*/
function generateHTML(swaggerDoc?: JsonObject | null,
generateHTML(swaggerDoc?: JsonObject | null,
opts?: SwaggerUiOptions | false | null,
options?: SwaggerOptions,
customCss?: string | false | null,
@@ -79,7 +79,9 @@ declare namespace SwaggerUiExpress {
* @param opts options to pass to Swagger UI.
* @returns Express handlers that process requests and return files for Swagger UI.
*/
function serveFiles(swaggerDoc?: JsonObject, opts?: SwaggerUiOptions): RequestHandler[];
serveFiles(swaggerDoc?: JsonObject, opts?: SwaggerUiOptions): RequestHandler[];
}
export default SwaggerUiExpress;
declare const swaggerUiExpress: SwaggerUiExpress;
export = swaggerUiExpress;
@@ -2,21 +2,25 @@
* Tests are taken from the module's repository at https://github.com/scottie1984/swagger-ui-express/blob/master/test/testapp/app.js
*/
import swaggerUi from "swagger-ui-express";
import swaggerUi = require('swagger-ui-express');
import express = require('express');
const express = require('express');
const app = express();
const swaggerDocument = require('./swagger.json');
const swaggerDocumentSplit = require('./swagger-split.json');
const swaggerDocument = {
swagger: '2.0',
info: { version: '1.0.0', title: 'Example API' },
paths: { '/user': { get: { responses: { 200: { description: 'all users' } } } } }
};
const swaggerDocumentSplit = swaggerDocument;
const options = {
validatorUrl: null,
oauth: {
clientId: "your-client-id1",
clientSecret: "your-client-secret-if-required1",
realm: "your-realms1",
appName: "your-app-name1",
scopeSeparator: ",",
clientId: 'your-client-id1',
clientSecret: 'your-client-secret-if-required1',
realm: 'your-realms1',
appName: 'your-app-name1',
scopeSeparator: ',',
additionalQueryStringParams: {}
},
docExpansion: 'full',
+1 -4
View File
@@ -1,6 +1,3 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-var-requires": false
}
"extends": "dtslint/dt.json"
}