I have the following code for my swagger documentation. Here I am trying to create an API where I want to take input as an array of objects. so far I am doing like following.
{
method: 'POST',
path: '/api/Route',
handler: function(request, reply) {
//some operations
reply('Success');
},
config: {
description: 'Create a Route',
tags: ['api', 'user'],
auth: 'UserAuth',
validate: {
payload: {
"array": [{
userId: Joi.string().trim().required(),
status: Joi.number().required()
},
{
userId: Joi.string().trim().required(),
status: Joi.number().required()
},
{
userId: Joi.string().trim().required(),
status: Joi.number().required()
}
]
}
},
plugins: {
'hapi-swagger': {
responseMessages: swaggerDefaultResponseMessages
}
}
}
}
so what actually going on when I run the above code the swagger creates the documentation like this. this is a link to the image. so please can anybody tell me why I am not getting the whole array in swagger documentation instead getting only one element of the array. and I also saw the Following question but unable to understand in which file they are making these changes. Could anybody help? Thanks in advance.
