lib/ajv.js
function addSchema(schema, key, _skipValidation, _meta) {
  if (Array.isArray(schema)){
    for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
    return this;
  }
  var id = this._getId(schema);
  if (id !== undefined && typeof id != 'string')
    throw new Error('schema id must be string');
  key = resolve.normalizeId(key || id);
  checkUnique(this, key);
  this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
  return this;
}
function addSchema(schema, key, _skipValidation, _meta) {
  if (Array.isArray(schema)){
    for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
    return this;
  }
  var id = this._getId(schema);
  if (id !== undefined && typeof id != 'string')
    throw new Error('schema id must be string');
  key = resolve.normalizeId(key || id);
  checkUnique(this, key);
  this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
  return this;
}
function addSchema ( schema , key , _skipValidation , _meta ) { if ( Array . isArray ( schema ) ) { for ( var i = 0 ; i < schema . length ; i ++ ) this . addSchema ( schema [ i ] , undefined , _skipValidation , _meta ) ; return this ; } var id = this . _getId ( schema ) ; if ( id !== undefined && typeof id != 'string' ) throw new Error ( 'schema id must be string' ) ; key = resolve . normalizeId ( key || id ) ; checkUnique ( this , key ) ; this . _schemas [ key ] = this . _addSchema ( schema , _skipValidation , _meta , true ) ; return this ; }
Adds schema to the instance.
@this   Ajv
@param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
@param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
@param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
@param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
@return {Ajv} this for method chaining
Adds schema to the instance .