docs: def register(context, request, load):
      """Validate the username and password and create the user."""
      data = request.json
      res = validate(data, dataclass_to_jsl(
          RegistrationSchema).get_schema())
      if res:
          @request.after
          def set_error(response):
              response.status = 422
          return {
              'status': 'error',
              'field_errors': [{'message': res[x]} for x in res.keys()]
          }
  
      if data['password'] != data['password_validate']:
          @request.after
          def adjust_response(response):
              response.status = 422
  
          return {'status': 'error',
                  'message': 'Password confirmation does not match'}
  
      if 'state' not in data.keys() or not data['state']:
          data['state'] = request.app.settings.application.new_user_state
      del data['password_validate']
      obj = context.create(data)
      return {'status': 'success'}