Skip to content

Commit

Permalink
removed hyper meta-schema, same schema is used as latest meta-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Aug 21, 2015
1 parent 171a87b commit 7f37f1b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ By default the schema is validated against meta-schema before it is added, and i

Adds meta schema that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option).

There is no need to explicitly add draft 4 meta schema (http://json-schema.org/draft-04/schema) - it is added by default, unless option `meta` is set to `false`. You only need to use it if you have a changed meta-schema that you want to use to validate your schemas. See `validateSchema`.
There is no need to explicitly add draft 4 meta schema (http://json-schema.org/draft-04/schema and http://json-schema.org/schema) - it is added by default, unless option `meta` is set to `false`. You only need to use it if you have a changed meta-schema that you want to use to validate your schemas. See `validateSchema`.


##### .validateSchema(Object schema) -> Boolean
Expand Down Expand Up @@ -224,7 +224,7 @@ Options can have properties `separator` (string used to separate errors, ", " by
- _formats_: an object with custom formats. Keys and values will be passed to `addFormat` method.
- _schemas_: an array or object of schemas that will be added to the instance. If the order is important, pass array. In this case schemas must have IDs in them. Otherwise the object can be passed - `addSchema(value, key)` will be called for each schema in this object.
- _meta_: add [meta-schema](http://json-schema.org/documentation.html) so it can be used by other schemas (true by default).
- _validateSchema_: validate added/compiled schemas against meta-schema (true by default). `$schema` property in the schema can either be http://json-schema.org/draft-04/schema or absent (draft-4 meta-schema will be used) or can be a reference to the schema previously added with `addMetaSchema` method. If the validation fails, the exception is thrown. Pass "log" in this option to log error instead of throwing exception. Pass `false` to skip schema validation.
- _validateSchema_: validate added/compiled schemas against meta-schema (true by default). `$schema` property in the schema can either be http://json-schema.org/schema or http://json-schema.org/draft-04/schema or absent (draft-4 meta-schema will be used) or can be a reference to the schema previously added with `addMetaSchema` method. If the validation fails, the exception is thrown. Pass "log" in this option to log error instead of throwing exception. Pass `false` to skip schema validation.
- _missingRefs_: by default if the reference cannot be resolved during compilation the exception is thrown. Pass 'ignore' to log error during compilation and pass validation. Pass 'fail' to log error and successfully compile schema but fail validation if this rule is checked.
- _uniqueItems_: validate `uniqueItems` keyword (true by default).
- _unicode_: calculate correct length of strings with unicode pairs (true by default). Pass `false` to use `.length` of strings that is faster, but gives "incorrect" lengths of strings with unicode pairs - each unicode pair is counted as two characters.
Expand Down
8 changes: 1 addition & 7 deletions lib/ajv.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,8 @@ function Ajv(opts) {
function addInitialSchemas() {
if (self.opts.meta !== false) {
var metaSchema = require('./refs/json-schema-draft-04.json');

addMetaSchema(metaSchema, META_SCHEMA_ID, true);

// Add other schemas according to JSON specification:
// http://json-schema.org/latest/json-schema-core.html
addMetaSchema(metaSchema, 'http://json-schema.org/schema', true);
addMetaSchema(metaSchema, 'http://json-schema.org/hyper-schema', true);
addMetaSchema(metaSchema, 'http://json-schema.org/draft-04/hyper-schema', true);
self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID;
}

var optsSchemas = self.opts.schemas;
Expand Down

0 comments on commit 7f37f1b

Please sign in to comment.