Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with AJV not working. #745

Closed
shubham-shrivastava opened this issue Dec 23, 2020 · 10 comments
Closed

Integration with AJV not working. #745

shubham-shrivastava opened this issue Dec 23, 2020 · 10 comments

Comments

@shubham-shrivastava
Copy link

shubham-shrivastava commented Dec 23, 2020

  • Rollup Plugin Name: commonjs
  • Rollup Plugin Version: 17.0.0
  • Rollup Version: 2.35.1
  • Operating System (or Browser): popOS (ubuntu), Chrome (Version 87.0.4280.88 (Official Build) (64-bit))
  • Node Version: 10.20.1
  • Link to reproduction (⚠️ read below): https://github.com/shubham-shrivastava/rollup-ajv-test

Expected Behavior

There should not be any errors of undefined dependencies in the bundle when using AJV JSON schema validator

Actual Behavior

Two require from the same file results in undefined value for later.
for e.g.
const a = require("./file");
const b = require("./file");

this makes b undefined, hence any function called on b results in error.
It seems commonjs is not able to resolve the dependency correctly.

Running the file with tsc (or node) works fine.

Additional Information

The minimal repo to reproduce the above error is located at - https://github.com/shubham-shrivastava/rollup-ajv-test
Steps to reproduce -

  • npm i
  • npm run build:dev

This will open a tab in the browser, where you can see the error in the console.

@josdejong
Copy link

I'm hitting the same issue, in my case I get an error:

Uncaught TypeError: dataType_2 is undefined

This error is originating in the file ajv/dist/compile/validate/iterate.js:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.schemaKeywords = void 0;
const applicability_1 = require("./applicability");
const dataType_1 = require("./dataType.js");
const defaults_1 = require("./defaults");
const dataType_2 = require("./dataType.js");
// ...

The error seems to be gone when I manually remove const dataType_2 = require("./dataType.js"); and replace the usage of dataType_2 with dataType_1.

Ping @epoberezkin. A workaround would be to change the source code of Ajv such that it doesn't require("./dataType.js") twice I think.

@shubham-shrivastava
Copy link
Author

I'm hitting the same issue, in my case I get an error:

Uncaught TypeError: dataType_2 is undefined

This error is originating in the file ajv/dist/compile/validate/iterate.js:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.schemaKeywords = void 0;
const applicability_1 = require("./applicability");
const dataType_1 = require("./dataType.js");
const defaults_1 = require("./defaults");
const dataType_2 = require("./dataType.js");
// ...

The error seems to be gone when I manually remove const dataType_2 = require("./dataType.js"); and replace the usage of dataType_2 with dataType_1.

Ping @epoberezkin. A workaround would be to change the source code of Ajv such that it doesn't require("./dataType.js") twice I think.

Indeed. it's the same issue I am having.
and it comes from the compiled version of /node_modules/ajv/lib/compile/validate/iterate.ts

import type {SchemaObjCxt} from ".."
import type {JSONType, Rule, RuleGroup} from "../rules"
import {shouldUseGroup, shouldUseRule} from "./applicability"
import {checkDataType} from "./dataType"
import {assignDefaults} from "./defaults"
import {reportTypeError} from "./dataType"

thanks for the workaround, but changing the source code is not feasible, unfortunately (or if every developer can change the source code on their machine in the node_modules, which is not feasible)

@josdejong
Copy link

Yes, I mean it would be nice if @epoberezkin would be able to change the source code of Ajv such that it doesn't hit this issue with @rollup/plugin-commonjs (even though this is not really a bug in Ajv itself).

epoberezkin added a commit to ajv-validator/ajv that referenced this issue Dec 30, 2020
@epoberezkin
Copy link

Unfortunately I can't enable no-duplicate-imports with eslint-plugin 3.* and I am getting a ton of errors when I try to switch to 4.*

Obviously, the real problem is that this plugin is not supporting what it should probably support - there may be the cases when multiple requires of the same dependency are needed...

@shellscape
Copy link
Collaborator

@epoberezkin if there are specific cases where that antipattern is real and necessary, I'd encourage you to open a modification ticket and enumerate those cases. I can't think of a single valid case, but that's not to say there aren't. I don't believe the plug-in is behaving wrongly here.

@epoberezkin
Copy link

epoberezkin commented Dec 30, 2020

It's an opinion ;)

What is important here that it is incompatible with node.js - a call to require returns the export of the module regardless how many times it is called, but the module code should be executed only once (I've never read the spec itself, but node.js is what defines the standard de-facto).

The use case where it is needed is the dependency that is expensive to initialize is loaded on demand inside several functions that need it. The possible alternative is to memoize it in some module scoped variable, but it arguably makes it less obvious what is going on - so it is a matter of opinion which pattern is better.

Not the problem I need solved, though, just some comment in passing. I will publish Ajv change soon.

Happy New Year all :)

@shellscape
Copy link
Collaborator

@guybedford and @LarsDenBakker have put a lot of effort into getting commonjs and node-resolve spec compliant with exports - they may disagree with you on that one.

@josdejong
Copy link

It's a tricky case. Normally there isn't really a reason to have duplicate imports though it may happen and is valid code. It is just very unfortunate when this gives issues downstream (like now) which are not so easy to detect early (and maybe you're not in control of changing it). Having a linter in place would help prevent it from occurring, but still, it would be great if @rollup/plugin-commonjs would be robust against it 😄. Thanks for all your efforts @guybedford and @LarsDenBakker, this is really complex stuff.

@guybedford
Copy link
Contributor

Yes this is no doubt a bug, I've updated the labels. The fix might not even be too hard if someone wants to look into it. This is a perfect example of the sort of open source bug where picking up a little more ownership on the level beneath you and solving the small issue that directly helps you while also improving the situation for others can, as a general rule, form a healthy ecosystem.

bors bot added a commit to comit-network/comit-rs that referenced this issue Jan 3, 2021
3462: ⬆️ Bump ajv from 6.12.6 to 7.0.3 in /tests r=mergify[bot] a=dependabot[bot]

Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.12.6 to 7.0.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/ajv-validator/ajv/releases">ajv's releases</a>.</em></p>
<blockquote>
<h2>v7.0.3</h2>
<p>Fixes:</p>
<ul>
<li>oneOf error type (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1368">#1368</a>, <a href="https://github.com/G-Rath">@G-Rath</a>)</li>
<li>remove multiple imports (rollup/plugins#745)</li>
</ul>
<p>Docs:</p>
<ul>
<li>Using in ES5 (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1364">#1364</a>, <a href="https://github.com/aladdin-add">@aladdin-add</a>)</li>
<li>Option strictTypes: false has to be used with json-schema-secure schema (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1373">#1373</a>)</li>
</ul>
<h2>v7.0.2</h2>
<p>Remove duplicate functions from standalone validation code (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1361">#1361</a>)</p>
<h2>v7.0.1</h2>
<p>Update error message for <code>maxLength</code>/<code>minLength</code> keywords</p>
<h2>v7.0.0</h2>
<p>Please note: this document covers the changes from v6.12.6.</p>
<h1>The main changes</h1>
<ul>
<li>support of JSON Schema draft-2019-09 features: <a href="https://github.com/ajv-validator/ajv/blob/master/docs/json-schema.md#unevaluatedproperties"><code>unevaluatedProperties</code></a> and <a href="https://github.com/ajv-validator/ajv/blob/master/docs/json-schema.md#unevaluateditems"><code>unevaluatedItems</code></a>, <a href="https://github.com/ajv-validator/ajv/blob/master/docs/validation.md#extending-recursive-schemas">dynamic recursive references</a> and other <a href="https://github.com/ajv-validator/ajv/blob/master/docs/json-schema.md#json-schema-draft-2019-09">additional keywords</a>.</li>
<li>comprehensive support for <a href="https://github.com/ajv-validator/ajv/blob/master/docs/standalone.md">standalone validation code</a> - compiling one or multiple schemas to standalone modules with one or multiple exports.</li>
<li>to reduce the mistakes in JSON schemas and unexpected validation results, <a href="https://github.com/ajv-validator/ajv/blob/v7-beta/docs/strict-mode.md">strict mode</a> is added - it prohibits ignored or ambiguous JSON Schema elements. See <a href="https://github.com/ajv-validator/ajv/blob/v7-beta/docs/strict-mode.md">Strict mode</a> and <a href="https://github.com/ajv-validator/ajv/blob/v7-beta/docs/api.md">Options</a> for more details</li>
<li>to make code injection from untrusted schemas impossible, <a href="https://github.com/ajv-validator/ajv/blob/v7-beta/docs/codegen.md">code generation</a> is fully re-written to be type-level safe against code injection.</li>
<li>to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas.</li>
<li>schemas are compiled to ES6 code (ES5 code generation is supported with an option).</li>
<li>to improve reliability and maintainability the code is migrated to TypeScript.</li>
<li>separate Ajv classes from draft-07 and draft-2019-09 support with different default imports (see <a href="https://github.com/ajv-validator/ajv#usage">Getting started</a> or <a href="https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.5">v7.0.0-beta.5</a> for the details).</li>
</ul>
<p><strong>Please note</strong>:</p>
<ul>
<li>the support for JSON-Schema draft-04 is removed - if you have schemas using &quot;id&quot; attributes you have to replace them with &quot;$id&quot; (or continue using version 6 that will be supported until 02/28/2021).</li>
<li>all formats are separated to <a href="https://github.com/ajv-validator/ajv-formats">ajv-formats</a> package - they have to be explicitly added if you use them.</li>
<li>Ajv instance can only be created with <code>new</code> keyword, as Ajv is now ES6 class.</li>
<li>browser bundles are automatically published to ajv-dist package (but still available on cdnjs.com).</li>
<li>order of schema keyword validation changed - keywords that apply to all types (allOf etc.) are now validated first, before the keywords that apply to specific data types. You can still define custom keywords that apply to all types AND are validated after type-specific keywords using option <code>post: true</code> in keyword definition.</li>
</ul>
<h2>Better TypeScript support:</h2>
<ul>
<li>Methods <code>compile</code> and <code>compileAsync</code> now return type-guards - see <a href="https://github.com/ajv-validator/ajv/tree/v7-beta#usage">Getting started</a>.</li>
<li>Method <code>validate</code> is a type-guard.</li>
<li>Better separation of asynchronous schemas on type level.</li>
<li>Type utility JSONSchemaType<!-- raw HTML omitted --> that generates the type for JSON Schema for type interface in the type parameter - it simplifies writing schemas (no unions support at the moment).</li>
</ul>
<h2>API changes:</h2>
<ul>
<li>addVocabulary - NEW method that allows to add an array of keyword definitions.</li>
<li>addKeyword - keyword name should be passed as property in definition object, not as the first parameter (old API works with &quot;deprecated&quot; warning). Also &quot;inline&quot; keywords support is removed, code generation keywords can now be defined with &quot;code&quot; keyword - the same definition format that is used by all pre-defined keywords</li>
<li>Ajv no longer allows to create the instance without <code>new</code> keyword (it is ES6 class).</li>
</ul>
<h3>Added options (and defaults):</h3>
<ul>
<li>strict: true - strict mode</li>
<li>strictTypes: &quot;log&quot; - prevent mistakes related to type keywords and keyword applicability (see <a href="https://github.com/ajv-validator/ajv/blob/v7-beta/docs/strict-mode.md#strict-types">Strict Types</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/ajv-validator/ajv/commit/ca2ae61c489f45fa2ec3ff2ee78b10136cb1ed3c"><code>ca2ae61</code></a> 7.0.3</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/78cc974351034e1b39e7864fcf0f844f0e3cb309"><code>78cc974</code></a> Merge branch 'hello-weiran-issue1364'</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/c44597e3e19f711c1892eea04807ca0c67b11d95"><code>c44597e</code></a> docs: move &quot;using in ES5 env&quot; to readme</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/d0b1368559d634339c6f1fe87be471c322b84f74"><code>d0b1368</code></a> Merge branch 'issue1364' of <a href="https://github.com/hello-weiran/ajv">https://github.com/hello-weiran/ajv</a> into hello-we...</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/9200e928c8927bf6c626d5f9488b6e9ca7e6171d"><code>9200e92</code></a> docs: add option to the example using json-schema-secure schema (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1373">#1373</a>)</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/4de9bfb53397d2d2c3d8e3fc38b6237dcac40c2b"><code>4de9bfb</code></a> remove duplicate import (rollup/plugins#745)</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/97bfa50862cfcaf8fe998507c45dcb8bf4adcb88"><code>97bfa50</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1370">#1370</a> from caub/patch-1</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/71ef1e09d3d5065d1da2e03a06f1bc18dff6f652"><code>71ef1e0</code></a> fix range example typos</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/342b84dbe6b4d02eceea22592294238ff1e56fe9"><code>342b84d</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1368">#1368</a> from G-Rath/patch-2</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/9121a870ebfa3bb6b1d072cc91b4cd2c22b817ef"><code>9121a87</code></a> fix: add <code>| null</code> to <code>OneOfError</code> param property</li>
<li>Additional commits viewable in <a href="https://github.com/ajv-validator/ajv/compare/v6.12.6...v7.0.3">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ajv&package-manager=npm_and_yarn&previous-version=6.12.6&new-version=7.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually


</details>

3463: ⬆️ Bump @types/node from 14.14.17 to 14.14.19 in /tests r=mergify[bot] a=dependabot[bot]

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.17 to 14.14.19.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=14.14.17&new-version=14.14.19)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
bors bot added a commit to comit-network/comit-rs that referenced this issue Jan 3, 2021
3462: ⬆️ Bump ajv from 6.12.6 to 7.0.3 in /tests r=mergify[bot] a=dependabot[bot]

Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.12.6 to 7.0.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/ajv-validator/ajv/releases">ajv's releases</a>.</em></p>
<blockquote>
<h2>v7.0.3</h2>
<p>Fixes:</p>
<ul>
<li>oneOf error type (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1368">#1368</a>, <a href="https://github.com/G-Rath">@G-Rath</a>)</li>
<li>remove multiple imports (rollup/plugins#745)</li>
</ul>
<p>Docs:</p>
<ul>
<li>Using in ES5 (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1364">#1364</a>, <a href="https://github.com/aladdin-add">@aladdin-add</a>)</li>
<li>Option strictTypes: false has to be used with json-schema-secure schema (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1373">#1373</a>)</li>
</ul>
<h2>v7.0.2</h2>
<p>Remove duplicate functions from standalone validation code (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1361">#1361</a>)</p>
<h2>v7.0.1</h2>
<p>Update error message for <code>maxLength</code>/<code>minLength</code> keywords</p>
<h2>v7.0.0</h2>
<p>Please note: this document covers the changes from v6.12.6.</p>
<h1>The main changes</h1>
<ul>
<li>support of JSON Schema draft-2019-09 features: <a href="https://github.com/ajv-validator/ajv/blob/master/docs/json-schema.md#unevaluatedproperties"><code>unevaluatedProperties</code></a> and <a href="https://github.com/ajv-validator/ajv/blob/master/docs/json-schema.md#unevaluateditems"><code>unevaluatedItems</code></a>, <a href="https://github.com/ajv-validator/ajv/blob/master/docs/validation.md#extending-recursive-schemas">dynamic recursive references</a> and other <a href="https://github.com/ajv-validator/ajv/blob/master/docs/json-schema.md#json-schema-draft-2019-09">additional keywords</a>.</li>
<li>comprehensive support for <a href="https://github.com/ajv-validator/ajv/blob/master/docs/standalone.md">standalone validation code</a> - compiling one or multiple schemas to standalone modules with one or multiple exports.</li>
<li>to reduce the mistakes in JSON schemas and unexpected validation results, <a href="https://github.com/ajv-validator/ajv/blob/v7-beta/docs/strict-mode.md">strict mode</a> is added - it prohibits ignored or ambiguous JSON Schema elements. See <a href="https://github.com/ajv-validator/ajv/blob/v7-beta/docs/strict-mode.md">Strict mode</a> and <a href="https://github.com/ajv-validator/ajv/blob/v7-beta/docs/api.md">Options</a> for more details</li>
<li>to make code injection from untrusted schemas impossible, <a href="https://github.com/ajv-validator/ajv/blob/v7-beta/docs/codegen.md">code generation</a> is fully re-written to be type-level safe against code injection.</li>
<li>to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas.</li>
<li>schemas are compiled to ES6 code (ES5 code generation is supported with an option).</li>
<li>to improve reliability and maintainability the code is migrated to TypeScript.</li>
<li>separate Ajv classes from draft-07 and draft-2019-09 support with different default imports (see <a href="https://github.com/ajv-validator/ajv#usage">Getting started</a> or <a href="https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.5">v7.0.0-beta.5</a> for the details).</li>
</ul>
<p><strong>Please note</strong>:</p>
<ul>
<li>the support for JSON-Schema draft-04 is removed - if you have schemas using &quot;id&quot; attributes you have to replace them with &quot;$id&quot; (or continue using version 6 that will be supported until 02/28/2021).</li>
<li>all formats are separated to <a href="https://github.com/ajv-validator/ajv-formats">ajv-formats</a> package - they have to be explicitly added if you use them.</li>
<li>Ajv instance can only be created with <code>new</code> keyword, as Ajv is now ES6 class.</li>
<li>browser bundles are automatically published to ajv-dist package (but still available on cdnjs.com).</li>
<li>order of schema keyword validation changed - keywords that apply to all types (allOf etc.) are now validated first, before the keywords that apply to specific data types. You can still define custom keywords that apply to all types AND are validated after type-specific keywords using option <code>post: true</code> in keyword definition.</li>
</ul>
<h2>Better TypeScript support:</h2>
<ul>
<li>Methods <code>compile</code> and <code>compileAsync</code> now return type-guards - see <a href="https://github.com/ajv-validator/ajv/tree/v7-beta#usage">Getting started</a>.</li>
<li>Method <code>validate</code> is a type-guard.</li>
<li>Better separation of asynchronous schemas on type level.</li>
<li>Type utility JSONSchemaType<!-- raw HTML omitted --> that generates the type for JSON Schema for type interface in the type parameter - it simplifies writing schemas (no unions support at the moment).</li>
</ul>
<h2>API changes:</h2>
<ul>
<li>addVocabulary - NEW method that allows to add an array of keyword definitions.</li>
<li>addKeyword - keyword name should be passed as property in definition object, not as the first parameter (old API works with &quot;deprecated&quot; warning). Also &quot;inline&quot; keywords support is removed, code generation keywords can now be defined with &quot;code&quot; keyword - the same definition format that is used by all pre-defined keywords</li>
<li>Ajv no longer allows to create the instance without <code>new</code> keyword (it is ES6 class).</li>
</ul>
<h3>Added options (and defaults):</h3>
<ul>
<li>strict: true - strict mode</li>
<li>strictTypes: &quot;log&quot; - prevent mistakes related to type keywords and keyword applicability (see <a href="https://github.com/ajv-validator/ajv/blob/v7-beta/docs/strict-mode.md#strict-types">Strict Types</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/ajv-validator/ajv/commit/ca2ae61c489f45fa2ec3ff2ee78b10136cb1ed3c"><code>ca2ae61</code></a> 7.0.3</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/78cc974351034e1b39e7864fcf0f844f0e3cb309"><code>78cc974</code></a> Merge branch 'hello-weiran-issue1364'</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/c44597e3e19f711c1892eea04807ca0c67b11d95"><code>c44597e</code></a> docs: move &quot;using in ES5 env&quot; to readme</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/d0b1368559d634339c6f1fe87be471c322b84f74"><code>d0b1368</code></a> Merge branch 'issue1364' of <a href="https://github.com/hello-weiran/ajv">https://github.com/hello-weiran/ajv</a> into hello-we...</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/9200e928c8927bf6c626d5f9488b6e9ca7e6171d"><code>9200e92</code></a> docs: add option to the example using json-schema-secure schema (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1373">#1373</a>)</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/4de9bfb53397d2d2c3d8e3fc38b6237dcac40c2b"><code>4de9bfb</code></a> remove duplicate import (rollup/plugins#745)</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/97bfa50862cfcaf8fe998507c45dcb8bf4adcb88"><code>97bfa50</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1370">#1370</a> from caub/patch-1</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/71ef1e09d3d5065d1da2e03a06f1bc18dff6f652"><code>71ef1e0</code></a> fix range example typos</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/342b84dbe6b4d02eceea22592294238ff1e56fe9"><code>342b84d</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1368">#1368</a> from G-Rath/patch-2</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/9121a870ebfa3bb6b1d072cc91b4cd2c22b817ef"><code>9121a87</code></a> fix: add <code>| null</code> to <code>OneOfError</code> param property</li>
<li>Additional commits viewable in <a href="https://github.com/ajv-validator/ajv/compare/v6.12.6...v7.0.3">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ajv&package-manager=npm_and_yarn&previous-version=6.12.6&new-version=7.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@stale
Copy link

stale bot commented Mar 2, 2021

Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it.

@stale stale bot closed this as completed Mar 2, 2021
bors bot added a commit to comit-network/comit-rs that referenced this issue Mar 7, 2021
3520: Bump ajv from 6.12.6 to 7.2.0 in /tests r=mergify[bot] a=dependabot[bot]

Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.12.6 to 7.2.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/ajv-validator/ajv/releases">ajv's releases</a>.</em></p>
<blockquote>
<h2>v7.2.0</h2>
<p>strictRequired option (off by default) - to log or fail if properties used in JSON Schema &quot;required&quot; are not defined in &quot;properties&quot; (<a href="https://github.com/PBug90"><code>@​PBug90</code></a>, <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1403">#1403</a>)</p>
<p>Compiled parsers (as fast as JSON.parse on valid JSON, but replace validation and fail much faster on invalid JSON) and serializers (10x+ faster than JSON.stringify) from JSON Type Definition schemas (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1454">#1454</a>) - see examples in <a href="https://ajv.js.org/guide/getting-started.html#parsing-and-serializing-json">javascript</a> and <a href="https://ajv.js.org/guide/typescript.html#type-safe-parsers-and-serializers">typescript</a></p>
<p>The website migrated to VuePress and documentation is restructured to make navigating Ajv documentation and learning easier - this is still work in progress, but already some improvement on the information structure. Any feedback/corrections would be very much appreciated!</p>
<p>Improved TypeScript support for JSONSchemaType:</p>
<ul>
<li>JTDSchemaType<!-- raw HTML omitted --> utility type to convert your data type into the type of JTD schema, to simplify its writing and to make sure it is consistent with your data type, with type inference support for ajv methods (<a href="https://github.com/erikbrinkman"><code>@​erikbrinkman</code></a>, <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1446">#1446</a>, <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1456">#1456</a>, <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1457">#1457</a>, <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1475">#1475</a>) - see <a href="https://ajv.js.org/guide/typescript.html#utility-types-for-schemas">example here</a></li>
<li>Alternatively, you can use JTDDataType<!-- raw HTML omitted --> utility type to convert your JTD schema type into the type of data (<a href="https://github.com/erikbrinkman"><code>@​erikbrinkman</code></a>, <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1458">#1458</a>) - see <a href="https://ajv.js.org/guide/typescript.html#utility-type-for-jtd-data-type">this example</a></li>
</ul>
<p>Other improvements by <a href="https://github.com/Fdawgs"><code>@​Fdawgs</code></a> (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1466">#1466</a>), <a href="https://github.com/t7yang"><code>@​t7yang</code></a> (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1472">#1472</a>, <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1473">#1473</a>), <a href="https://github.com/koba04"><code>@​koba04</code></a> (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1460">#1460</a>),</p>
<h2>v7.1.1</h2>
<p>Support readonly arrays with JSONSchemaType (<a href="https://github.com/LinusU"><code>@​LinusU</code></a>, <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1447">#1447</a>)</p>
<h2>v7.1.0</h2>
<p>Support for JSON Type Definition RFC 8927 - a simple schema language provided as an alternative to JSON Schema.</p>
<p>See these docs:</p>
<ul>
<li>an <a href="https://github.com/ajv-validator/ajv/blob/master/docs/json-type-definition.md">informal document</a> in Ajv repo</li>
<li><a href="https://datatracker.ietf.org/doc/rfc8927/">RFC8927</a></li>
<li><a href="https://github.com/ajv-validator/ajv#choosing-schema-language">choosing schema language</a> - comparison with JSON Schema</li>
</ul>
<p>Allow &quot;:&quot; in keyword names (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1421">#1421</a>, <a href="https://github.com/teq0"><code>@​teq0</code></a>)</p>
<h2>v7.0.4</h2>
<p>Fix: duplicate functions in standalone validation code with mutually recursive schemas (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1361">#1361</a>)
Fix: reference resolution when base URI change was not applied (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1414">#1414</a>)</p>
<h2>v7.0.3</h2>
<p>Fixes:</p>
<ul>
<li>oneOf error type (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1368">#1368</a>, <a href="https://github.com/G-Rath"><code>@​G-Rath</code></a>)</li>
<li>remove multiple imports (rollup/plugins#745)</li>
</ul>
<p>Docs:</p>
<ul>
<li>Using in ES5 (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1364">#1364</a>, <a href="https://github.com/aladdin-add"><code>@​aladdin-add</code></a>)</li>
<li>Option strictTypes: false has to be used with json-schema-secure schema (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1373">#1373</a>)</li>
</ul>
<h2>v7.0.2</h2>
<p>Remove duplicate functions from standalone validation code (<a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1361">#1361</a>)</p>
<h2>v7.0.1</h2>
<p>Update error message for <code>maxLength</code>/<code>minLength</code> keywords</p>
<h2>v7.0.0</h2>
<p>Please note: this document covers the changes from v6.12.6.</p>
<h1>The main changes</h1>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/ajv-validator/ajv/commit/9823d1d588762e10a05d5260c83a057eb11be3d8"><code>9823d1d</code></a> 7.2.0</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/db553ad00d8046ffc75b821c12a3e3ab5cea38d0"><code>db553ad</code></a> fix type inference for JTDSchemaType in compileParser/Serializer</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/23293bea73df2eb5add6cf384cc06785e69cae2d"><code>23293be</code></a> docs: add code block header</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/848d3f236a4792feee440733ab5948094acb3b7d"><code>848d3f2</code></a> docs: JSONDataType</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/0aa047bad652129ff39df2a403387988cf60e636"><code>0aa047b</code></a> fix indentation in code samples, turn off prettier for md files</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/22aa6833a09277df85966aa7e4c176546521d18d"><code>22aa683</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1458">#1458</a> from erikbrinkman/jtd-data</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/d5b4aa7d62334385cb3105f90494c449cb623a59"><code>d5b4aa7</code></a> Merge branch 'master' into jtd-data</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/937643ea98362c1d03e95e28b81f1098388e3c1f"><code>937643e</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1475">#1475</a> from erikbrinkman/infer</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/bbf7a51c8712478ec7afd38b10734b561b541d79"><code>bbf7a51</code></a> Merge branch 'master' into infer</li>
<li><a href="https://github.com/ajv-validator/ajv/commit/80d09b3431ed34e44691e3018d14d0e8a4fdf5d5"><code>80d09b3</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/ajv-validator/ajv/issues/1456">#1456</a> from erikbrinkman/null</li>
<li>Additional commits viewable in <a href="https://github.com/ajv-validator/ajv/compare/v6.12.6...v7.2.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ajv&package-manager=npm_and_yarn&previous-version=6.12.6&new-version=7.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
andriyl pushed a commit to Redocly/ajv that referenced this issue Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants