title: Best way to maintain only one schema between Mongoose and Joi
body: <p>I'm using Hapi to develop a web service, with Mongoose as ODM and Joi as validator. 
  I really like Joi's validation and the way it connects with HAPI (I need Joi's description function to display some description in swagger) but I don't want to maintain two schemas, one for Joi and one for mongoose; I would like to define my schema using Joi and then being able to export only the basic schema required by Mongoose. For example:</p>
  
  <p><strong>mySchema.js</strong></p>
  
  <pre><code>module.exports = {
      name : String,
      address: String
  }
  </code></pre>
  
  <p><strong>myValidator.js</strong></p>
  
  <pre><code>module.exports = {
      payload: {
          name: Joi.description('A name').string().required(),
          address: Joi.description('An address').string()
      }
  }
  </code></pre>
  
  <p><strong>myModel.js</strong></p>
  
  <pre><code>const mongoose = require('mongoose'),
      mySchema = require('./mySchema');
  
  var schemaInstance = new mongoose.Schema(mySchema),
      myModel = mongoose.model('myModel', schemaInstance);
  </code></pre>
  
  <p><strong>myHapiRoute.js</strong></p>
  
  <pre><code>const myValidator = require('./myValidator.js'),
      myController = require('./myController.js');
  
  ...
  
  {
      method: 'POST',
      path: '/create',
      config: {
          description: 'create something',
          tags: ['api'],
          handler: myController,
          validate: myValidator
      }
  }
  ...
  </code></pre>
  
  <p>I would like to avoid the hassle to maintain <strong>mySchema.js</strong> file generating it <strong>exactly</strong> from Joi's schema.</p>
  
  <p>Any suggestions on how to do it or any different approaches?</p>