skolmer / i18n-tag-schema

Generates a json schema for all i18n tagged template literals in your project
http://i18n-tag.kolmer.net
MIT License
15 stars 3 forks source link

Update ajv to the latest version πŸš€ #31

Closed greenkeeper[bot] closed 7 years ago

greenkeeper[bot] commented 7 years ago

Version 5.0.0 of ajv just got published.

Dependency ajv
Current Version 4.11.7
Type dependency

The version 5.0.0 is not covered by your current version range.

Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.

I recommend you look into these changes and try to get onto the latest version of ajv. Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.


Release Notes 5.0.0

This release is fully backward compatible, but it is likely to require either migrating your schemas (recommended, e.g. using "migrate" command of ajv-cli) or changing your code using Ajv.

You can still use draft-04 and v5 schemas with this release (see Migration guide below).

The changes below are based on 4.11.7 version.

JSON-Schema draft-06 support

  • Support for boolean schemas: wherever a schema is required, true/false can be used in order to always pass/fail validation.
  • $id keyword is used as schema URI (previously id).
  • exclusiveMaximum and exclusiveMinimum keywords must be numbers (previously boolean).
  • additional validation keywords: const, contains, propertyNames.
  • additional formats: uri-reference, uri-template.

See Internet drafts: JSON Schema, JSON Schema Validation.

Migrating from Ajv 4.x.x

Migrate your schemas

It is a recommended approach.

Required changes
  • replace id with $id
  • update $schema
  • replace boolean form of exclusiveMaximum/Minimum with numeric form
  • replace Ajv v5 constant with const
Optional changes
  • replace enum with a single allowed value with const
  • replace empty schemas with true
  • replace schemas {"not":{}} with false

You can use "migrate" command of ajv-cli to make these changes to your schemas.

If you need to continue using draft-04 schemas

var ajv = new Ajv({
  meta: false, // optional, to prevent adding draft-06 meta-schema
  extendRefs: true, // optional, current default is to 'fail', spec behaviour is to 'ignore'
  unknownFormats: 'ignore',  // optional, current default is true (fail)
  // ...
});

var metaSchema = require('ajv/lib/refs/json-schema-draft-04.json');
ajv.addMetaSchema(metaSchema);
ajv._opts.defaultMeta = metaSchema.id;

// optional, using unversioned URI is out of spec, see https://github.com/json-schema-org/json-schema-spec/issues/216
ajv._refs['http://json-schema.org/schema'] = 'http://json-schema.org/draft-04/schema';

// Optionally you can also disable keywords defined in draft-06
ajv.removeKeyword('propertyNames');
ajv.removeKeyword('contains');
ajv.removeKeyword('const');

If you use need to continue using schemas requiring v5 mode of Ajv

var ajv = new Ajv({
  $data: true,
  patternGroups: true,
  meta: false, // optional, to prevent adding draft-06 meta-schema
  extendRefs: true, // optional, current default is to 'fail', spec behaviour is to 'ignore'
  unknownFormats: 'ignore',  // optional, current default is true (fail)
  // ...
});

ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
ajv._refs['http://json-schema.org/schema'] = 'http://json-schema.org/draft-04/schema'; // optional, using unversioned URI is out of spec
var metaSchema = require('ajv/lib/refs/json-schema-v5.json');
ajv.addMetaSchema(metaSchema);
ajv._opts.defaultMeta = metaSchema.id;

// optional - to avoid changing the schemas
ajv.addKeyword('constant', { macro: x => ({ const: x }) }); // this keyword is renamed to const in draft-06
// you need to use version "^2.0.0" of ajv-keywords
require('ajv-keywords')(ajv, ['switch', 'patternRequired', 'formatMinimum', 'formatMaximum']);

// Optionally you can also disable propertyNames keyword defined in draft-06
ajv.removeKeyword('propertyNames');

Changes

Validation keywords

Moved/deprecated:

Formats

  • Support custom formats for numbers (#291).
  • Format "regex" is changed to prohibit \Z anchor.
  • Format "uri" is changed to only allow absolute URIs, relative URIs are supported with "uri-reference".
  • Added format "url" (WHATWG URL specification).

Methods

  • Methods are no longer bound to Ajv instances (#232).
  • compileAsync method returns Promise and supports async loading of meta-schemas (#249, #334).

Options

  • schemaId determining whether $id, id or both are used.
  • $data for $data reference support.
  • ownProperties supports all keywords (#197).
  • serialize to replace json-stable-stringify with another function to serialise schemas.
  • Log warning instead of throwing exception when option meta: false is used without validateSchema: false.
  • processCode: function() {} can be used to beautify/transpile generated code.
  • beautify: true is no longer supported.
  • v5 is no longer used.

Option defaults changed:

  • extendRefs: "ignore" - when $ref is used other keywords are ignored (was true) (#294).
  • sourceCode: false - do not store source code of validation functions (was true) (#309).
  • unknownFormats: true - fail schema compilation (was "ignore") (#324).

Asynchronous validation

  • Auto-detection of async mode and transpile option support require ajv-async package.
  • Default async mode is "co*" (co-wrapped generator functions).
  • If you need to transpile code without ajv-async package, you can pass transpilation function in processCode option. See Options.
  • In case of validation success, returned Promise resolves with validated data to simplify chaining (previously it resolved with true).

Other

  • Ajv.MissingRefError class is used to throw missing $ref exception.
  • Typings are updated - typescript 2.0 is required.
  • Errors are logged using console.warn and console.error (#265).
  • Improve error handling (#380, #394).
  • Improve webpack support (#403).

Related packages

Compatible versions are:

Commits

The new version differs by 144 commits .

  • 8641c6b version 5.0.0
  • fde7030 Merge pull request #464 from epoberezkin/5.0.0
  • 21818c7 Merge branch 'master' into 5.0.0
  • 2fc8a64 Merge branch 'master' into 5.0.0
  • 67dd36a version 5.0.4-beta.3
  • e82b62d Merge branch 'master' into 5.0.0
  • b8fdbd1 Merge branch 'gajus-feat/add-url-record-format' into 5.0.0
  • 8bb21dd Merge branch 'feat/add-url-record-format' of https://github.com/gajus/ajv into gajus-feat/add-url-record-format
  • 3b0eee3 Merge branch 'master' into 5.0.0
  • cc711fc docs: migrate schemas with ajv-cli
  • d9ee511 fix: modifying custom keyword should not update parent data of root data
  • 3f9ab64 feat: more comprehencive uri-reference format in {format: "full"} mode
  • 0b308db test: update JSON-Schema-Test-Suite, enable optional/bignum test
  • 2daf587 version 5.0.4-beta.0
  • 02f9a15 Merge branch 'master' into 5.0.0

There are 144 commits in total. See the full diff.

Not sure how things should work exactly? There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html) and of course you may always [ask my humans](https://github.com/greenkeeperio/greenkeeper/issues/new).

Your Greenkeeper Bot :palm_tree:

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 95.442% when pulling c08b8f357f90c0515cb99c6e73edf5da7778428f on greenkeeper/ajv-5.0.0 into 0f6185f3247dd26f2aa2f33e6eed4c395e451a33 on master.

greenkeeper[bot] commented 7 years ago

Version 5.0.1 just got published.

Update to this version instead πŸš€

Commits

The new version differs by 17 commits0.

  • 4504e97 version 5.0.1
  • 3aa523e Merge branch 'v4'
  • de9fad5 version 4.11.8
  • 4ed756e fix: duplicate "type" error is reported with coerceTypes option, fixes #469
  • 92bfeda test: skipped test for error reporting with coerceTypes option, #469
  • 9802e23 docs: migration note
  • 04852b1 Merge pull request #473 from mrjgreen/patch-1
  • b5661eb Update README.md
  • 2fb973d Merge pull request #470 from RobDesideri/patch-1
  • ac6c49d Correct typo in README
  • 20aa542 docs: update issue template
  • c229260 Merge pull request #465 from ehmicky/patch-1
  • 0acbdac Document uri-template format
  • 8cb411a docs: use new Ajv in runkit example
  • 995822f docs: remove npm install beta

There are 17 commits in total.

See the full diff

greenkeeper[bot] commented 7 years ago

Version 5.1.0 just got published.

Update to this version instead πŸš€

Release Notes v5.1.0

Changed order of type validation - "type" keyword is now validated before keywords that apply to all types.

Commits

The new version differs by 7 commits0.

  • d2cb328 5.1.0
  • a8d91c5 Merge pull request #488 from epoberezkin/type-validation
  • a02b9a6 refactor: make sure "type": "integer" is vaildated before other keywords, closes #485
  • f60fedb feat: validate types before other keywords, #485
  • 6f0ff64 docs: fix example for additionalProperties keyword
  • 78fffde Merge pull request #479 from handrews/error-doc
  • a71cece docs: FAQ for additionalProperties error messages

false

See the full diff

greenkeeper[bot] commented 7 years ago

Version 5.1.1 just got published.

Update to this version instead πŸš€

Commits

The new version differs by 2 commits0.

  • a454569 5.1.1
  • 58a2272 fix: incorrect integer validation, closes #490

false

See the full diff

greenkeeper[bot] commented 7 years ago

Version 5.1.2 just got published.

Update to this version instead πŸš€

Commits

The new version differs by 13 commits.

  • 29e6238 5.1.2
  • 9e5eeb1 Merge branch 'blainesch-patch-1'
  • fc66d31 docs: it.util.equal
  • d01a0b8 Expose equal from util.
  • bd1af60 Merge branch 'boenrobot-uglify3'
  • a7804bd Made bundle.js write the uncompressed bundle only when standalone is present. Previously, it would instead write it, and remove it later if applicable.
  • 38808e1 Merge branch 'master' into uglify3
  • 5d9c93b Merge pull request #484 from epoberezkin/greenkeeper/initial
  • be552a6 Tweaked bundle.js to support UglifyJS3.
  • 8ffd98c use uglify-js 2.x
  • f3abd13 Merge branch 'master' into greenkeeper/initial
  • 4b7e422 docs(readme): add Greenkeeper badge
  • 0829178 chore(package): update dependencies

See the full diff

greenkeeper[bot] commented 7 years ago

Version 5.1.3 just got published.

Update to this version instead πŸš€

Commits

The new version differs by 4 commits.

  • 788bb7b 5.1.3
  • 022a825 test: additional tests to verify number of errors when type is used
  • 6f1f083 fix: type validation
  • cad7605 Revert "refactor: make sure "type": "integer" is vaildated before other keywords, closes #485"

See the full diff

greenkeeper[bot] commented 7 years ago

Version 5.1.4 just got published.

Update to this version instead πŸš€

Commits

The new version differs by 7 commits.

  • 5f1a8fd 5.1.4
  • 08cbec7 fix: add var
  • 2977088 fix: contains allows empty array when sibling property uses $ref in schema, closes #502
  • 78ba5ef test: failing test for #502 (contains allows epty array when sibling property uses $ref in schema)
  • f2f7a7d test: add jshint
  • d41c12b docs: fix link
  • b05f9d9 docs: corrections

See the full diff