hapi-swagger / hapi-swagger

A Swagger interface for hapi
https://hapi.dev/
MIT License
913 stars 420 forks source link

Joi 9.0.0-3+ causes arrays of objects examples to not display correctly #305

Closed BuffCoder closed 8 years ago

BuffCoder commented 8 years ago

I recently upgraded to Joi 9.0.4 and noticed my swagger documention for arrays of objects is displaying as follows:

screen shot 2016-08-01 at 2 45 31 pm

I played around with the versions and found the same code works on Joi 8.4.1 to display things correctly:

screen shot 2016-08-01 at 2 45 12 pm

Below is the following response object I'm attaching to my Hapi route:

response: {
  sample: 0,
  schema: Joi.array()
    .items(Joi.object({
      id: Joi.string().example('abc'),
      team: Joi.string().example('coreproduct'),
      channel: Joi.string().example('general'),
      disabled: Joi.boolean().example(false)
    }))
    .label('Webhook')
}

Is anyone else experiencing similar issues? For the time being I reverted Joi to 8.4.1.

glennjones commented 8 years ago

Hi Have you updated to the latest versions of hapi-swagger either v6.2.0 or v6.2.1 If you are on one of theses versions and still having issues let me know.

BuffCoder commented 8 years ago

Shoot, that would do it. Could have sworn I updated. Sorry about that, thanks for the quick reply!