outmoded / lout

API documentation generator
Other
276 stars 49 forks source link

9.0.0 Release Notes #151

Closed Marsup closed 8 years ago

Marsup commented 8 years ago

Summary

Starting from this release, only Joi v8+ is supported.

Only Joi v8+ is supported.

Since Joi changed its description format, this has an unexpected consequence for hapi users using the short version of a validation. Considering a route like :

server.route({
  method: 'GET',
  path: '/',
  handler(request, reply) {
    [...]
  },
  validate: {
    query: {
      foo: Joi.string()
    }
  }

Hapi automatically converts the query schema into a Joi schema, but it is doing so by using its own version of Joi, thus producing (currently with hapi v13) Joi v7 objects. You may experience lout errors on a few schemas that are using references. If you want to avoid those errors, the best way is to provide hapi an already built schema, so the example above becomes :

server.route({
  method: 'GET',
  path: '/',
  handler(request, reply) {
    [...]
  },
  validate: {
    query: Joi.object({
      foo: Joi.string()
    })
  }
AdriVanHoudt commented 8 years ago

@Marsup is there going to be a patch version for hapi to bump joi version?

Marsup commented 8 years ago

No idea, you'd have to ask there. IMHO there's no hurry as you can easily work around hapi's built-in conversion.