koa-joi-router-docs
koa-joi-router-docs copied to clipboard
Change swagger API document CDN
It does not describe required at path parameters and nullable at response object body like this below picture.
Here is Joi schema.
see, https://github.com/Redocly/redoc
meta: {
...
},
validate: {
params: {
_id: Joi.string().alphanum().max(24).example('abcdefg').description('User id').required() // <- note here
},
output: {
'200-299': {
body: Joi.object({
userId: Joi.string().allow(null).required().description('User id') // <- note here
}).options({
allowUnknown: true
}).description('User object')
},
500: {
body: Joi.object({
message: Joi.string().description('error message')
}).description('error body')
}
},
handler: async (ctx) => {
....
}
-
before
-
after