title: Is it necessary to use multiple Joi schema validations with Hapi?
body: <p>I looked at an existing codebase and and I noticed that the codebase had two schema validations for what I feel a single schema could validate as the second schema is an offshoot of the first.
  See codebase below.</p>
  <pre><code>export const StudentSchema = Joi.object().keys({
      _id,
      name,
      dob,
      gender,
      grade
  });
  
  export const StudentUpdateSchema = Joi.object().keys({
      name,
      dob,
  })
  </code></pre>
  <p>Now these schema are being used in the following routes:</p>
  <pre><code>//CREATE ROUTE
  {
      method: 'POST',
      path: '/students/{id}',
      handler: async (request) =&gt; {
          const { id } = request.params;
          return Student.create(id, request.payload);
      },
      options: {
          ...sharedOptions,
          description: 'Enrolling a student',
          validate: {
              failAction,
              payload: StudentSchema,
              params: {
                  studentId: Joi.objectId().required()
              },
          },
          response: {
              status: {
                  200: StudentSchema,
                  400: Joi.any(),
              },
          },
      },
  },
  // UPDATE ROUTE
  {
          method: 'PUT',
          path: '/students/{id}',
          handler: async (request) =&gt; {
              const { id } = request.params;
              return Student.update(Id, { $set: request.payload });
          },
          options: {
              ...sharedOptions,
              description: 'Update student details',
              validate: {
                  failAction,
                  payload: StudentUpdateSchema,
                  params: {
                      studentId: Joi.objectId().required(),
                  },
              },
              response: {
                  status: {
                      200: StudentSchema,
                      400: Joi.any(),
                      404: Joi.any(),
                  },
              },
          },
      }
  </code></pre>
  <p>I am new to Hapi but have some experience with Express and Mongoose and I am inclined to re-writing these validations to use ONLY the StudentSchema in both the 'POST' and 'PUT' method since the StudentSchema contains all that is required to handle both the create and update functionality.</p>
  <p>Can anyone with experience in HapiJS validate the pros/cons of using a single schema object (in this case StudentSchema) or should I continue the current paradigm of using the two schemas?</p>