Browse Source

chore: refactoring of the ModelDataValidator class

e22m4u 1 year ago
parent
commit
865f99b9e3
2 changed files with 1491 additions and 1494 deletions
  1. 6 11
      src/definition/model/model-data-validator.js
  2. 1485 1483
      src/definition/model/model-data-validator.spec.js

+ 6 - 11
src/definition/model/model-data-validator.js

@@ -64,14 +64,9 @@ export class ModelDataValidator extends Service {
         propValue,
         propValue,
       );
       );
     }
     }
-    // DataType
-    await this._validatePropertyValueType(
-      modelName,
-      propName,
-      propDef,
-      propValue,
-    );
-    // PropertyValidators
+    // Property type.
+    await this._validateByPropertyType(modelName, propName, propDef, propValue);
+    // Property validators.
     await this._validateByPropertyValidators(
     await this._validateByPropertyValidators(
       modelName,
       modelName,
       propName,
       propName,
@@ -81,7 +76,7 @@ export class ModelDataValidator extends Service {
   }
   }
 
 
   /**
   /**
-   * Validate value type.
+   * Validate by property type.
    *
    *
    * @param {string} modelName
    * @param {string} modelName
    * @param {string} propName
    * @param {string} propName
@@ -90,7 +85,7 @@ export class ModelDataValidator extends Service {
    * @param {boolean} isArrayValue
    * @param {boolean} isArrayValue
    * @returns {Promise<void>}
    * @returns {Promise<void>}
    */
    */
-  async _validatePropertyValueType(
+  async _validateByPropertyType(
     modelName,
     modelName,
     propName,
     propName,
     propDef,
     propDef,
@@ -139,7 +134,7 @@ export class ModelDataValidator extends Service {
       case DataType.ARRAY:
       case DataType.ARRAY:
         if (!Array.isArray(propValue)) throw createError('an Array');
         if (!Array.isArray(propValue)) throw createError('an Array');
         const arrayItemsValidationPromises = propValue.map(async value =>
         const arrayItemsValidationPromises = propValue.map(async value =>
-          this._validatePropertyValueType(
+          this._validateByPropertyType(
             modelName,
             modelName,
             propName,
             propName,
             propDef,
             propDef,

+ 1485 - 1483
src/definition/model/model-data-validator.spec.js

@@ -174,1780 +174,1782 @@ describe('ModelDataValidator', function () {
       });
       });
     });
     });
 
 
-    describe('DataType.ANY', function () {
-      describe('ShortPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ANY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
+    describe('validate by property type', function () {
+      describe('DataType.ANY', function () {
+        describe('ShortPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ANY,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ANY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ANY,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ANY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
+          it('does not throw an error if a string given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ANY,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ANY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+          it('does not throw an error if a number given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ANY,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ANY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+          it('does not throw an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ANY,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ANY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+          it('does not throw an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ANY,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ANY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: [],
+          it('does not throw an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ANY,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ANY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: {},
+          it('does not throw an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ANY,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
           });
           });
         });
         });
-      });
 
 
-      describe('FullPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ANY,
+        describe('FullPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ANY,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ANY,
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ANY,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ANY,
+          it('does not throw an error if a string given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ANY,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ANY,
+          it('does not throw an error if a number given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ANY,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ANY,
+          it('does not throw an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ANY,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ANY,
+          it('does not throw an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ANY,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ANY,
+          it('does not throw an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ANY,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: [],
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ANY,
+          it('does not throw an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ANY,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: {},
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
           });
           });
         });
         });
       });
       });
-    });
-
-    describe('DataType.STRING', function () {
-      describe('ShortPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.STRING,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
-          });
-        });
 
 
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.STRING,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
+      describe('DataType.STRING', function () {
+        describe('ShortPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.STRING,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.STRING,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.STRING,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-        });
 
 
-        it('throws an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.STRING,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+          it('does not throw an error if a string given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.STRING,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a String, but Number given.',
-          );
-        });
 
 
-        it('throws an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.STRING,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+          it('throws an error if a number given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.STRING,
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a String, but Number given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a String, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.STRING,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+          it('throws an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.STRING,
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a String, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a String, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.STRING,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: [],
+          it('throws an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.STRING,
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a String, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a String, but Array given.',
-          );
-        });
 
 
-        it('throws an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.STRING,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: {},
+          it('throws an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.STRING,
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a String, but Array given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a String, but Object given.',
-          );
-        });
-      });
 
 
-      describe('FullPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.STRING,
+          it('throws an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.STRING,
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a String, but Object given.',
+            );
           });
           });
         });
         });
 
 
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.STRING,
+        describe('FullPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.STRING,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.STRING,
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.STRING,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-        });
 
 
-        it('throws an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.STRING,
+          it('does not throw an error if a string given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.STRING,
+                },
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a String, but Number given.',
-          );
-        });
 
 
-        it('throws an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.STRING,
+          it('throws an error if a number given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.STRING,
+                },
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a String, but Number given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a String, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.STRING,
+          it('throws an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.STRING,
+                },
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a String, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a String, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.STRING,
+          it('throws an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.STRING,
+                },
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: [],
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a String, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a String, but Array given.',
-          );
-        });
 
 
-        it('throws an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.STRING,
+          it('throws an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.STRING,
+                },
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: {},
-          });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a String, but Object given.',
-          );
-        });
-      });
-    });
-
-    describe('DataType.NUMBER', function () {
-      describe('ShortPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.NUMBER,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
-          });
-        });
-
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.NUMBER,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
-          });
-        });
-
-        it('throws an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.NUMBER,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
-          });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Number, but String given.',
-          );
-        });
-
-        it('does not throw an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.NUMBER,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
-          });
-        });
-
-        it('throws an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.NUMBER,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: true,
-          });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Number, but Boolean given.',
-          );
-        });
-
-        it('throws an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.NUMBER,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: false,
-          });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Number, but Boolean given.',
-          );
-        });
-
-        it('throws an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.NUMBER,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: [],
-          });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Number, but Array given.',
-          );
-        });
-
-        it('throws an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.NUMBER,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: {},
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a String, but Array given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Number, but Object given.',
-          );
-        });
-      });
 
 
-      describe('FullPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.NUMBER,
+          it('throws an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.STRING,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a String, but Object given.',
+            );
           });
           });
         });
         });
+      });
 
 
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.NUMBER,
+      describe('DataType.NUMBER', function () {
+        describe('ShortPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.NUMBER,
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-        });
 
 
-        it('throws an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.NUMBER,
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.NUMBER,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Number, but String given.',
-          );
-        });
 
 
-        it('does not throw an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.NUMBER,
+          it('throws an error if a string given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.NUMBER,
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Number, but String given.',
+            );
           });
           });
-        });
 
 
-        it('throws an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.NUMBER,
+          it('does not throw an error if a number given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.NUMBER,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Number, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.NUMBER,
+          it('throws an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.NUMBER,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Number, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Number, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.NUMBER,
+          it('throws an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.NUMBER,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: [],
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Number, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Number, but Array given.',
-          );
-        });
 
 
-        it('throws an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.NUMBER,
+          it('throws an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.NUMBER,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: {},
-          });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Number, but Object given.',
-          );
-        });
-      });
-    });
-
-    describe('DataType.BOOLEAN', function () {
-      describe('ShortPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.BOOLEAN,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
-          });
-        });
-
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.BOOLEAN,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
-          });
-        });
-
-        it('throws an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.BOOLEAN,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Number, but Array given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Boolean, but String given.',
-          );
-        });
 
 
-        it('throws an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.BOOLEAN,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+          it('throws an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.NUMBER,
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Number, but Object given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Boolean, but Number given.',
-          );
         });
         });
 
 
-        it('does not throw an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.BOOLEAN,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+        describe('FullPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.NUMBER,
+                },
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.BOOLEAN,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.NUMBER,
+                },
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-        });
 
 
-        it('throws an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.BOOLEAN,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: [],
+          it('throws an error if a string given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.NUMBER,
+                },
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Number, but String given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Boolean, but Array given.',
-          );
-        });
 
 
-        it('throws an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.BOOLEAN,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: {},
+          it('does not throw an error if a number given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.NUMBER,
+                },
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Boolean, but Object given.',
-          );
-        });
-      });
 
 
-      describe('FullPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.BOOLEAN,
+          it('throws an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.NUMBER,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Number, but Boolean given.',
+            );
           });
           });
-        });
 
 
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.BOOLEAN,
+          it('throws an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.NUMBER,
+                },
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Number, but Boolean given.',
+            );
           });
           });
-        });
 
 
-        it('throws an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.BOOLEAN,
+          it('throws an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.NUMBER,
+                },
               },
               },
-            },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Number, but Array given.',
+            );
           });
           });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
+
+          it('throws an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.NUMBER,
+                },
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Number, but Object given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Boolean, but String given.',
-          );
         });
         });
+      });
 
 
-        it('throws an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.BOOLEAN,
+      describe('DataType.BOOLEAN', function () {
+        describe('ShortPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.BOOLEAN,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Boolean, but Number given.',
-          );
-        });
 
 
-        it('does not throw an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.BOOLEAN,
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.BOOLEAN,
               },
               },
-            },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+
+          it('throws an error if a string given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.BOOLEAN,
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Boolean, but String given.',
+            );
           });
           });
-        });
 
 
-        it('does not throw an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.BOOLEAN,
+          it('throws an error if a number given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.BOOLEAN,
               },
               },
-            },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Boolean, but Number given.',
+            );
           });
           });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+
+          it('does not throw an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.BOOLEAN,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
           });
           });
-        });
 
 
-        it('throws an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.BOOLEAN,
+          it('does not throw an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.BOOLEAN,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: [],
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Boolean, but Array given.',
-          );
-        });
 
 
-        it('throws an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.BOOLEAN,
+          it('throws an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.BOOLEAN,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: {},
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Boolean, but Array given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'a Boolean, but Object given.',
-          );
-        });
-      });
-    });
 
 
-    describe('DataType.ARRAY', function () {
-      describe('ShortPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ARRAY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
+          it('throws an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.BOOLEAN,
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Boolean, but Object given.',
+            );
           });
           });
         });
         });
 
 
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ARRAY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
+        describe('FullPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.BOOLEAN,
+                },
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-        });
 
 
-        it('throws an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ARRAY,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.BOOLEAN,
+                },
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Array, but String given.',
-          );
-        });
 
 
-        it('throws an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ARRAY,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+          it('throws an error if a string given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.BOOLEAN,
+                },
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Boolean, but String given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Array, but Number given.',
-          );
-        });
 
 
-        it('throws an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ARRAY,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+          it('throws an error if a number given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.BOOLEAN,
+                },
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Boolean, but Number given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Array, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ARRAY,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+          it('does not throw an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.BOOLEAN,
+                },
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Array, but Boolean given.',
-          );
-        });
 
 
-        it('does not throw an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ARRAY,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: [],
+          it('does not throw an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.BOOLEAN,
+                },
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
           });
           });
-        });
 
 
-        it('throws an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.ARRAY,
-            },
+          it('throws an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.BOOLEAN,
+                },
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Boolean, but Array given.',
+            );
           });
           });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: {},
+
+          it('throws an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.BOOLEAN,
+                },
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'a Boolean, but Object given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Array, but Object given.',
-          );
         });
         });
       });
       });
 
 
-      describe('FullPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ARRAY,
+      describe('DataType.ARRAY', function () {
+        describe('ShortPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ARRAY,
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ARRAY,
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ARRAY,
               },
               },
-            },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
+
+          it('throws an error if a string given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ARRAY,
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Array, but String given.',
+            );
           });
           });
-        });
 
 
-        it('throws an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ARRAY,
+          it('throws an error if a number given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ARRAY,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Array, but Number given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Array, but String given.',
-          );
-        });
 
 
-        it('throws an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ARRAY,
+          it('throws an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ARRAY,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Array, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Array, but Number given.',
-          );
-        });
 
 
-        it('throws an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ARRAY,
+          it('throws an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ARRAY,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Array, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Array, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ARRAY,
+          it('does not throw an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ARRAY,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Array, but Boolean given.',
-          );
-        });
 
 
-        it('does not throw an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ARRAY,
+          it('throws an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.ARRAY,
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: [],
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Array, but Object given.',
+            );
           });
           });
         });
         });
 
 
-        it('throws an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.ARRAY,
+        describe('FullPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ARRAY,
+                },
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: {},
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Array, but Object given.',
-          );
-        });
 
 
-        describe('the "model" option', function () {
-          it('throws an error when the given object element has an invalid model', async function () {
+          it('does not throw an error if a null given', async function () {
             const S = new Schema();
             const S = new Schema();
             S.defineModel({
             S.defineModel({
-              name: 'modelA',
+              name: 'model',
+              datasource: 'datasource',
               properties: {
               properties: {
-                foo: DataType.STRING,
+                foo: {
+                  type: DataType.ARRAY,
+                },
               },
               },
             });
             });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
+          });
+
+          it('throws an error if a string given', async function () {
+            const S = new Schema();
             S.defineModel({
             S.defineModel({
-              name: 'modelB',
+              name: 'model',
               datasource: 'datasource',
               datasource: 'datasource',
               properties: {
               properties: {
-                bar: {
+                foo: {
                   type: DataType.ARRAY,
                   type: DataType.ARRAY,
-                  itemType: DataType.OBJECT,
-                  model: 'modelA',
                 },
                 },
               },
               },
             });
             });
-            const promise = S.getService(ModelDataValidator).validate(
-              'modelB',
-              {
-                bar: [{foo: 10}],
-              },
-            );
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
             await expect(promise).to.be.rejectedWith(
             await expect(promise).to.be.rejectedWith(
-              'The property "foo" of the model "modelA" must have ' +
-                'a String, but Number given.',
+              'The property "foo" of the model "model" must have ' +
+                'an Array, but String given.',
             );
             );
           });
           });
 
 
-          it('does not throw an error when the given object element has a valid model', async function () {
+          it('throws an error if a number given', async function () {
             const S = new Schema();
             const S = new Schema();
             S.defineModel({
             S.defineModel({
-              name: 'modelA',
+              name: 'model',
+              datasource: 'datasource',
               properties: {
               properties: {
-                foo: DataType.STRING,
+                foo: {
+                  type: DataType.ARRAY,
+                },
               },
               },
             });
             });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Array, but Number given.',
+            );
+          });
+
+          it('throws an error if true given', async function () {
+            const S = new Schema();
             S.defineModel({
             S.defineModel({
-              name: 'modelB',
+              name: 'model',
               datasource: 'datasource',
               datasource: 'datasource',
               properties: {
               properties: {
-                bar: {
+                foo: {
                   type: DataType.ARRAY,
                   type: DataType.ARRAY,
-                  itemType: DataType.OBJECT,
-                  model: 'modelA',
                 },
                 },
               },
               },
             });
             });
-            await S.getService(ModelDataValidator).validate('modelB', {
-              bar: [{foo: '10'}],
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: true,
             });
             });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Array, but Boolean given.',
+            );
           });
           });
-        });
-      });
-    });
-
-    describe('DataType.OBJECT', function () {
-      describe('ShortPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.OBJECT,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
-          });
-        });
-
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.OBJECT,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
-          });
-        });
-
-        it('throws an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.OBJECT,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
-          });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Object, but String given.',
-          );
-        });
 
 
-        it('throws an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.OBJECT,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+          it('throws an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ARRAY,
+                },
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Array, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Object, but Number given.',
-          );
-        });
 
 
-        it('throws an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.OBJECT,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+          it('does not throw an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ARRAY,
+                },
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Object, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.OBJECT,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+          it('throws an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.ARRAY,
+                },
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Array, but Object given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Object, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.OBJECT,
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: [],
-          });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Object, but Array given.',
-          );
-        });
+          describe('the "model" option', function () {
+            it('throws an error when the given object element has an invalid model', async function () {
+              const S = new Schema();
+              S.defineModel({
+                name: 'modelA',
+                properties: {
+                  foo: DataType.STRING,
+                },
+              });
+              S.defineModel({
+                name: 'modelB',
+                datasource: 'datasource',
+                properties: {
+                  bar: {
+                    type: DataType.ARRAY,
+                    itemType: DataType.OBJECT,
+                    model: 'modelA',
+                  },
+                },
+              });
+              const promise = S.getService(ModelDataValidator).validate(
+                'modelB',
+                {
+                  bar: [{foo: 10}],
+                },
+              );
+              await expect(promise).to.be.rejectedWith(
+                'The property "foo" of the model "modelA" must have ' +
+                  'a String, but Number given.',
+              );
+            });
 
 
-        it('does not throw an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: DataType.OBJECT,
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: {},
+            it('does not throw an error when the given object element has a valid model', async function () {
+              const S = new Schema();
+              S.defineModel({
+                name: 'modelA',
+                properties: {
+                  foo: DataType.STRING,
+                },
+              });
+              S.defineModel({
+                name: 'modelB',
+                datasource: 'datasource',
+                properties: {
+                  bar: {
+                    type: DataType.ARRAY,
+                    itemType: DataType.OBJECT,
+                    model: 'modelA',
+                  },
+                },
+              });
+              await S.getService(ModelDataValidator).validate('modelB', {
+                bar: [{foo: '10'}],
+              });
+            });
           });
           });
         });
         });
       });
       });
 
 
-      describe('FullPropertyDefinition', function () {
-        it('does not throw an error if an undefined given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.OBJECT,
+      describe('DataType.OBJECT', function () {
+        describe('ShortPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.OBJECT,
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: undefined,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-        });
 
 
-        it('does not throw an error if a null given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.OBJECT,
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.OBJECT,
               },
               },
-            },
-          });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: null,
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-        });
 
 
-        it('throws an error if a string given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.OBJECT,
+          it('throws an error if a string given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.OBJECT,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 'bar',
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Object, but String given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Object, but String given.',
-          );
-        });
 
 
-        it('throws an error if a number given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.OBJECT,
+          it('throws an error if a number given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.OBJECT,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: 10,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Object, but Number given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Object, but Number given.',
-          );
-        });
 
 
-        it('throws an error if true given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.OBJECT,
+          it('throws an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.OBJECT,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: true,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Object, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Object, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if false given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.OBJECT,
+          it('throws an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.OBJECT,
               },
               },
-            },
-          });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: false,
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Object, but Boolean given.',
+            );
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Object, but Boolean given.',
-          );
-        });
 
 
-        it('throws an error if an array given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.OBJECT,
+          it('throws an error if an array given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.OBJECT,
               },
               },
-            },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Object, but Array given.',
+            );
           });
           });
-          const promise = S.getService(ModelDataValidator).validate('model', {
-            foo: [],
+
+          it('does not throw an error if an object given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: DataType.OBJECT,
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
           });
           });
-          await expect(promise).to.be.rejectedWith(
-            'The property "foo" of the model "model" must have ' +
-              'an Object, but Array given.',
-          );
         });
         });
 
 
-        it('does not throw an error if an object given', async function () {
-          const S = new Schema();
-          S.defineModel({
-            name: 'model',
-            datasource: 'datasource',
-            properties: {
-              foo: {
-                type: DataType.OBJECT,
+        describe('FullPropertyDefinition', function () {
+          it('does not throw an error if an undefined given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.OBJECT,
+                },
               },
               },
-            },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: undefined,
+            });
           });
           });
-          await S.getService(ModelDataValidator).validate('model', {
-            foo: {},
+
+          it('does not throw an error if a null given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.OBJECT,
+                },
+              },
+            });
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: null,
+            });
           });
           });
-        });
 
 
-        describe('the "model" option', function () {
-          it('throws an error when the given object has an invalid model', async function () {
+          it('throws an error if a string given', async function () {
             const S = new Schema();
             const S = new Schema();
             S.defineModel({
             S.defineModel({
-              name: 'modelA',
+              name: 'model',
+              datasource: 'datasource',
               properties: {
               properties: {
-                foo: DataType.STRING,
+                foo: {
+                  type: DataType.OBJECT,
+                },
               },
               },
             });
             });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 'bar',
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Object, but String given.',
+            );
+          });
+
+          it('throws an error if a number given', async function () {
+            const S = new Schema();
             S.defineModel({
             S.defineModel({
-              name: 'modelB',
+              name: 'model',
               datasource: 'datasource',
               datasource: 'datasource',
               properties: {
               properties: {
-                bar: {
+                foo: {
                   type: DataType.OBJECT,
                   type: DataType.OBJECT,
-                  model: 'modelA',
                 },
                 },
               },
               },
             });
             });
-            const promise = S.getService(ModelDataValidator).validate(
-              'modelB',
-              {
-                bar: {foo: 10},
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: 10,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Object, but Number given.',
+            );
+          });
+
+          it('throws an error if true given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.OBJECT,
+                },
               },
               },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: true,
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Object, but Boolean given.',
             );
             );
+          });
+
+          it('throws an error if false given', async function () {
+            const S = new Schema();
+            S.defineModel({
+              name: 'model',
+              datasource: 'datasource',
+              properties: {
+                foo: {
+                  type: DataType.OBJECT,
+                },
+              },
+            });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: false,
+            });
             await expect(promise).to.be.rejectedWith(
             await expect(promise).to.be.rejectedWith(
-              'The property "foo" of the model "modelA" must have ' +
-                'a String, but Number given.',
+              'The property "foo" of the model "model" must have ' +
+                'an Object, but Boolean given.',
             );
             );
           });
           });
 
 
-          it('does not throw an error when the given object has a valid model', async function () {
+          it('throws an error if an array given', async function () {
             const S = new Schema();
             const S = new Schema();
             S.defineModel({
             S.defineModel({
-              name: 'modelA',
+              name: 'model',
+              datasource: 'datasource',
               properties: {
               properties: {
-                foo: DataType.STRING,
+                foo: {
+                  type: DataType.OBJECT,
+                },
               },
               },
             });
             });
+            const promise = S.getService(ModelDataValidator).validate('model', {
+              foo: [],
+            });
+            await expect(promise).to.be.rejectedWith(
+              'The property "foo" of the model "model" must have ' +
+                'an Object, but Array given.',
+            );
+          });
+
+          it('does not throw an error if an object given', async function () {
+            const S = new Schema();
             S.defineModel({
             S.defineModel({
-              name: 'modelB',
+              name: 'model',
               datasource: 'datasource',
               datasource: 'datasource',
               properties: {
               properties: {
-                bar: {
+                foo: {
                   type: DataType.OBJECT,
                   type: DataType.OBJECT,
-                  model: 'modelA',
                 },
                 },
               },
               },
             });
             });
-            await S.getService(ModelDataValidator).validate('modelB', {
-              bar: {foo: '10'},
+            await S.getService(ModelDataValidator).validate('model', {
+              foo: {},
+            });
+          });
+
+          describe('the "model" option', function () {
+            it('throws an error when the given object has an invalid model', async function () {
+              const S = new Schema();
+              S.defineModel({
+                name: 'modelA',
+                properties: {
+                  foo: DataType.STRING,
+                },
+              });
+              S.defineModel({
+                name: 'modelB',
+                datasource: 'datasource',
+                properties: {
+                  bar: {
+                    type: DataType.OBJECT,
+                    model: 'modelA',
+                  },
+                },
+              });
+              const promise = S.getService(ModelDataValidator).validate(
+                'modelB',
+                {
+                  bar: {foo: 10},
+                },
+              );
+              await expect(promise).to.be.rejectedWith(
+                'The property "foo" of the model "modelA" must have ' +
+                  'a String, but Number given.',
+              );
+            });
+
+            it('does not throw an error when the given object has a valid model', async function () {
+              const S = new Schema();
+              S.defineModel({
+                name: 'modelA',
+                properties: {
+                  foo: DataType.STRING,
+                },
+              });
+              S.defineModel({
+                name: 'modelB',
+                datasource: 'datasource',
+                properties: {
+                  bar: {
+                    type: DataType.OBJECT,
+                    model: 'modelA',
+                  },
+                },
+              });
+              await S.getService(ModelDataValidator).validate('modelB', {
+                bar: {foo: '10'},
+              });
             });
             });
           });
           });
         });
         });