Projekt

Obecné

Profil

Stáhnout (474 Bajtů) Statistiky
| Větev: | Revize:
1
'use strict';
2

    
3
module.exports = function defFunc(ajv) {
4
  defFunc.definition = {
5
    type: 'object',
6
    macro: function (schema, parentSchema) {
7
      if (!schema) return true;
8
      var properties = Object.keys(parentSchema.properties);
9
      if (properties.length == 0) return true;
10
      return {required: properties};
11
    },
12
    metaSchema: {type: 'boolean'},
13
    dependencies: ['properties']
14
  };
15

    
16
  ajv.addKeyword('allRequired', defFunc.definition);
17
  return ajv;
18
};
(3-3/21)