DefinitelyTyped/types/swagger-ui-dist/index.d.ts
Piotr Błażejewicz (Peter Blazejewicz) 18204efa01
🤖 Merge PR #46358 update(swagger-ui-dist): update module detail and minor version bump by @peterblazejewicz
This commit tries to correct the module definition to match actual shape
of the module:
- direct access to exported absolute path function
- namespace based access from main module
- minor version bump (3.30)
- maintainer added
- minor cleanup

This change should be bacward compatible with pre-existin client code.

https://github.com/swagger-api/swagger-ui/blob/master/swagger-ui-dist-package/absolute-path.js
https://github.com/swagger-api/swagger-ui/blob/master/swagger-ui-dist-package/index.js
https://www.npmjs.com/package/swagger-ui-dist

Thanks!
2020-07-28 14:08:56 -04:00

130 lines
4.3 KiB
TypeScript

// Type definitions for swagger-ui-dist 3.30
// Project: https://github.com/swagger-api/swagger-ui#readme
// Definitions by: Haowen <https://github.com/haowen737>
// Bryce <https://github.com/brycematheson1234>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import implementation = require('./absolute-path');
export as namespace SwaggerUIDist;
/**
* get an absolute path to swagger ui for static file serving
*/
export const getAbsoluteFSPath: typeof implementation;
export const absolutePath: typeof implementation;
export const SwaggerUIStandalonePreset: any;
export const SwaggerUIBundle: SwaggerUIBundle;
export interface Url {
url: string;
name: string;
}
export interface Spec {
[k: string]: any;
}
export interface SwaggerConfigs {
/**
* URL to fetch external configuration document from.
*/
configUrl?: string;
/**
* If set to true, enables deep linking for tags and operations. See the Deep Linking documentation for more information.
*/
deepLinking?: boolean;
/**
* REQUIRED if domNode is not provided. The ID of a DOM element inside which SwaggerUI will put its user interface.
*/
dom_id?: string | null;
/**
* REQUIRED if dom_id is not provided. The HTML DOM element inside which SwaggerUI will put its user interface. Overrides dom_id.
*/
domNode?: string | HTMLElement | null;
/**
* An array of presets to use in Swagger UI. Usually, you'll want to include ApisPreset if you use this option.
*/
presets?: any[];
/**
* An array of plugin functions to use in Swagger UI.
*/
plugins?: any;
/**
* A JavaScript object describing the OpenAPI definition. When used, the url parameter will not be parsed. This is useful for testing manually-generated definitions without hosting them.
*/
spec?: Spec;
/**
* The URL pointing to API definition (normally swagger.json or swagger.yaml). Will be ignored if urls or spec is used.
*/
url?: Url['url'];
/**
* An array of API definition objects ([{url: "<url1>", name: "<name1>"},{url: "<url2>", name: "<name2>"}]) used by Topbar plugin. When used and Topbar plugin is enabled,
* the url parameter will not be parsed. Names and URLs must be unique among all items in this array,
* since they're used as identifiers.
*/
urls?: Url[];
/**
* The name of a component available via the plugin system to use as the top-level layout for Swagger UI.
*/
layout?: string;
/**
* Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing).
*/
docExpansion?: 'list' | 'full' | 'none';
/**
* If set, limits the number of tagged operations displayed to at most this many. The default is to show all operations.
*/
maxDisplayedTags?: number;
/**
* Apply a sort to the operation list of each API.
* It can be 'alpha' (sort by paths alphanumerically), 'method' (sort by HTTP method) or a function (see Array.prototype.sort() to know how sort function works).
* Default is the order returned by the server unchanged.
*/
operationsSorter?: () => void;
/**
* Function to intercept remote definition, "Try it out", and OAuth 2.0 requests.
* Accepts one argument requestInterceptor(request) and must return the modified request, or a Promise that resolves to the modified request.
*/
requestInterceptor?: (request: SwaggerRequest) => SwaggerRequest;
/**
* Function to intercept remote definition, "Try it out", and OAuth 2.0 responses.
* Accepts one argument responseInterceptor(response) and must return the modified response, or a Promise that resolves to the modified response.
*/
responseInterceptor?: (response: SwaggerResponse) => SwaggerResponse;
[k: string]: any;
}
export interface SwaggerUIBundle {
(a?: SwaggerConfigs): any;
[k: string]: any;
getConfigs(): SwaggerConfigs;
}
export interface SwaggerRequest {
url: string;
credentials: string;
[k: string]: any;
}
export interface SwaggerResponse {
[k: string]: any;
}