mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
express-openapi: fix argument object of initialize method
This commit is contained in:
@@ -10,7 +10,14 @@ var api:openapi.InitializedApi;
|
||||
api = openapi.initialize({
|
||||
apiDoc: require('./api-doc.js'),
|
||||
app: app,
|
||||
routes: './api-routes'
|
||||
routes: './api-routes',
|
||||
docPath: '/doc',
|
||||
exposeApiDocs: true,
|
||||
validateApiDoc: true,
|
||||
errorTransformer: (openapiError, jsonschemaError) => {},
|
||||
customFormats: {
|
||||
myFormat: input => { return true; },
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(3000);
|
||||
|
||||
36
express-openapi/express-openapi.d.ts
vendored
36
express-openapi/express-openapi.d.ts
vendored
@@ -248,9 +248,14 @@ declare module "express-openapi" {
|
||||
}
|
||||
|
||||
export interface Args {
|
||||
apiDoc: OpenApi.ApiDefinition,
|
||||
app: express.Application,
|
||||
apiDoc: OpenApi.ApiDefinition
|
||||
app: express.Application
|
||||
routes: string
|
||||
docPath: string
|
||||
errorTransformer(openapiError: OpenapiError, jsonschemaError: JsonschemaError): any
|
||||
exposeApiDocs: boolean
|
||||
validateApiDoc: boolean
|
||||
customFormats: CustomFormats
|
||||
}
|
||||
|
||||
export interface OperationFunction extends express.RequestHandler {
|
||||
@@ -275,6 +280,33 @@ declare module "express-openapi" {
|
||||
head?: Operation;
|
||||
}
|
||||
|
||||
export interface OpenapiError {
|
||||
errorCode: string
|
||||
location: string
|
||||
message: string
|
||||
path: string
|
||||
}
|
||||
|
||||
export interface CustomFormats {
|
||||
[index: string]: CustomFormatValidator
|
||||
}
|
||||
|
||||
// Following 2 interfaces are part of jsonschema package.
|
||||
interface JsonschemaError {
|
||||
property: string
|
||||
message: string
|
||||
schema: string|IJsonSchema
|
||||
instance: any
|
||||
name: string
|
||||
argument: any
|
||||
stack: string
|
||||
toString(): string
|
||||
}
|
||||
|
||||
interface CustomFormatValidator {
|
||||
(input: any): boolean
|
||||
}
|
||||
|
||||
interface IJsonSchema {
|
||||
id?: string
|
||||
$schema?: string
|
||||
|
||||
Reference in New Issue
Block a user