Skip to content

Commit 545e0cb

Browse files
authored
Update api-schema-builder (#96)
* update deps * Support OpenApi formats by default * Accept JSON Schema in constructor * Update types
1 parent 1fcb424 commit 545e0cb

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

package-lock.json

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"author": "Idan Tovi",
5757
"license": "Apache-2.0",
5858
"dependencies": {
59-
"api-schema-builder": "^1.1.6",
59+
"api-schema-builder": "^1.2.0",
6060
"memoizee": "^0.4.14"
6161
},
6262
"devDependencies": {

types/index.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
* configuration options. This function should be called
77
* before using `validate` middleware.
88
*/
9-
export function init(swaggerPath: string, options?: ajvValidatorOptions): void;
9+
declare function init(schemaPath: string, options?: ajvValidatorOptions): void;
10+
declare function init(jsonSchema: Object, options?: ajvValidatorOptions): void;
11+
export { init };
1012

1113
/**
1214
* Middleware that validates the request against the swagger
1315
* file, according to the request method and route
1416
*/
15-
declare function validate(ctx: any, next: Function): void; // koa
16-
declare function validate(req: any, res: any, next: Function): void; // express
17+
declare function validate(ctx: Object, next: Function): void; // koa
18+
declare function validate(req: Object, res: Object, next: Function): void; // express
1719
export { validate };
1820

1921
export class InputValidationError extends Error {

0 commit comments

Comments
 (0)