mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #32920 from NotWoods/koa-joi-router_output
Set koa-joi-router output object types
This commit is contained in:
Vendored
+3
-1
@@ -31,6 +31,8 @@ declare namespace createRouter {
|
||||
|
||||
type Method = (path: string|RegExp, handlerOrConfig: Handler | object, ...handlers: Handler[]) => Router;
|
||||
|
||||
type OutputValidation = { body: Joi.SchemaLike } | { headers: Joi.SchemaLike };
|
||||
|
||||
interface Spec {
|
||||
method: string|string[];
|
||||
path: string|RegExp;
|
||||
@@ -47,7 +49,7 @@ declare namespace createRouter {
|
||||
formOptions?: CoBody.Options;
|
||||
jsonOptions?: CoBody.Options;
|
||||
multipartOptions?: CoBody.Options;
|
||||
output?: {[status: string]: Joi.SchemaLike};
|
||||
output?: {[status: string]: OutputValidation};
|
||||
continueOnError?: boolean;
|
||||
};
|
||||
meta?: any;
|
||||
|
||||
@@ -41,8 +41,16 @@ const spec4: router.Spec = {
|
||||
validate: {
|
||||
type: 'json',
|
||||
output: {
|
||||
201: Joi.object(),
|
||||
'400,404': Joi.object(),
|
||||
201: {
|
||||
body: Joi.object(),
|
||||
},
|
||||
'400,404': {
|
||||
headers: Joi.object(),
|
||||
body: Joi.object(),
|
||||
},
|
||||
'500-599': {
|
||||
headers: Joi.object(),
|
||||
},
|
||||
},
|
||||
jsonOptions: {
|
||||
limit: '10kb'
|
||||
|
||||
Reference in New Issue
Block a user