koa-joi-router-docs icon indicating copy to clipboard operation
koa-joi-router-docs copied to clipboard

Change swagger API document CDN

Open i-kay opened this issue 4 years ago • 0 comments

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 image

  • after image

i-kay avatar Jul 03 '20 11:07 i-kay