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

Bump ajv from 6.11.0 to 8.6.3 #399

Merged
merged 2 commits into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 29 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"devDependencies": {
"@actions/core": "^1.6.0",
"@octokit/rest": "^18.12.0",
"ajv": "^6.11.0",
"ajv": "^8.6.3",
"ajv-formats": "^2.1.1",
"auto-changelog": "^2.3.0",
"jsdom": "^17.0.0",
"mocha": "^9.1.2",
Expand Down
2 changes: 1 addition & 1 deletion schema/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"specs": {
"type": "object",
"propertyNames": {
"$ref": "definitions.json#/proptype/url"
"$ref": "definitions.json#/$defs/url"
},
"additionalProperties": {
"type": "object",
Expand Down
34 changes: 17 additions & 17 deletions schema/definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/schema#",
"$id": "https://w3c.github.io/browser-specs/schema/definitions.json",

"proptype": {
"$defs": {
"url": {
"type": "string",
"format": "uri"
Expand All @@ -20,7 +20,7 @@

"shortname": {
"type": "string",
"pattern": "^[\\w\\-]+((?<=\\-\\d+)\\.\\d+)?$"
"pattern": "^[\\w\\-]+((?<=-\\d+)\\.\\d+)?$"
},

"series": {
Expand All @@ -30,9 +30,9 @@
"type": "string",
"pattern": "^[\\w\\-]+$"
},
"currentSpecification": { "$ref": "#/proptype/shortname" },
"releaseUrl": { "$ref": "#/proptype/url" },
"nightlyUrl": { "$ref": "#/proptype/url" }
"currentSpecification": { "$ref": "#/$defs/shortname" },
"releaseUrl": { "$ref": "#/$defs/url" },
"nightlyUrl": { "$ref": "#/$defs/url" }
},
"required": ["shortname"],
"additionalProperties": false
Expand Down Expand Up @@ -64,11 +64,11 @@
"release": {
"type": "object",
"properties": {
"url": { "$ref": "#/proptype/url" },
"filename": { "$ref": "#/proptype/filename" },
"url": { "$ref": "#/$defs/url" },
"filename": { "$ref": "#/$defs/filename" },
"pages": {
"type": "array",
"items": { "$ref": "#/proptype/url" }
"items": { "$ref": "#/$defs/url" }
}
},
"required": ["url"],
Expand All @@ -78,30 +78,30 @@
"nightly": {
"type": "object",
"properties": {
"url": { "$ref": "#/proptype/url" },
"filename": { "$ref": "#/proptype/filename" },
"sourcePath": { "$ref": "#/proptype/relativePath" },
"url": { "$ref": "#/$defs/url" },
"filename": { "$ref": "#/$defs/filename" },
"sourcePath": { "$ref": "#/$defs/relativePath" },
"pages": {
"type": "array",
"items": { "$ref": "#/proptype/url" }
"items": { "$ref": "#/$defs/url" }
},
"repository": { "$ref": "#/proptype/url" }
"repository": { "$ref": "#/$defs/url" }
},
"additionalProperties": false
},

"tests": {
"type": "object",
"properties": {
"repository": { "$ref": "#/proptype/url" },
"repository": { "$ref": "#/$defs/url" },
"testPaths": {
"type": "array",
"items": { "$ref": "#/proptype/relativePath" },
"items": { "$ref": "#/$defs/relativePath" },
"minItems": 1
},
"excludePaths": {
"type": "array",
"items": { "$ref": "#/proptype/relativePath" },
"items": { "$ref": "#/$defs/relativePath" },
"minItems": 1
}
},
Expand All @@ -115,7 +115,7 @@
"type": "object",
"properties": {
"name": { "type": "string" },
"url": { "$ref": "#/proptype/url" }
"url": { "$ref": "#/$defs/url" }
},
"required": ["name", "url"],
"additionalProperties": false
Expand Down
30 changes: 15 additions & 15 deletions schema/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
"items": {
"type": "object",
"properties": {
"url": { "$ref": "definitions.json#/proptype/url" },
"shortname": { "$ref": "definitions.json#/proptype/shortname" },
"series": { "$ref": "definitions.json#/proptype/series" },
"seriesVersion": { "$ref": "definitions.json#/proptype/seriesVersion" },
"seriesComposition": { "$ref": "definitions.json#/proptype/seriesComposition" },
"seriesPrevious": { "$ref": "definitions.json#/proptype/shortname" },
"seriesNext": { "$ref": "definitions.json#/proptype/shortname" },
"nightly": { "$ref": "definitions.json#/proptype/nightly" },
"tests": { "$ref": "definitions.json#/proptype/tests" },
"release": { "$ref": "definitions.json#/proptype/release" },
"title": { "$ref": "definitions.json#/proptype/title" },
"shortTitle": { "$ref": "definitions.json#/proptype/title" },
"source": { "$ref": "definitions.json#/proptype/source" },
"organization": { "$ref": "definitions.json#/proptype/organization" },
"groups": { "$ref": "definitions.json#/proptype/groups" }
"url": { "$ref": "definitions.json#/$defs/url" },
"shortname": { "$ref": "definitions.json#/$defs/shortname" },
"series": { "$ref": "definitions.json#/$defs/series" },
"seriesVersion": { "$ref": "definitions.json#/$defs/seriesVersion" },
"seriesComposition": { "$ref": "definitions.json#/$defs/seriesComposition" },
"seriesPrevious": { "$ref": "definitions.json#/$defs/shortname" },
"seriesNext": { "$ref": "definitions.json#/$defs/shortname" },
"nightly": { "$ref": "definitions.json#/$defs/nightly" },
"tests": { "$ref": "definitions.json#/$defs/tests" },
"release": { "$ref": "definitions.json#/$defs/release" },
"title": { "$ref": "definitions.json#/$defs/title" },
"shortTitle": { "$ref": "definitions.json#/$defs/title" },
"source": { "$ref": "definitions.json#/$defs/source" },
"organization": { "$ref": "definitions.json#/$defs/organization" },
"groups": { "$ref": "definitions.json#/$defs/groups" }
},
"required": [
"url", "shortname", "series", "seriesComposition", "nightly",
Expand Down
20 changes: 10 additions & 10 deletions schema/specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
{
"type": "object",
"properties": {
"url": { "$ref": "definitions.json#/proptype/url" },
"shortname": { "$ref": "definitions.json#/proptype/shortname" },
"series": { "$ref": "definitions.json#/proptype/series" },
"seriesVersion": { "$ref": "definitions.json#/proptype/seriesVersion" },
"seriesComposition": { "$ref": "definitions.json#/proptype/seriesComposition" },
"nightly": { "$ref": "definitions.json#/proptype/nightly" },
"tests": { "$ref": "definitions.json#/proptype/tests" },
"shortTitle": { "$ref": "definitions.json#/proptype/title" },
"organization": { "$ref": "definitions.json#/proptype/organization" },
"groups": { "$ref": "definitions.json#/proptype/groups" },
"url": { "$ref": "definitions.json#/$defs/url" },
"shortname": { "$ref": "definitions.json#/$defs/shortname" },
"series": { "$ref": "definitions.json#/$defs/series" },
"seriesVersion": { "$ref": "definitions.json#/$defs/seriesVersion" },
"seriesComposition": { "$ref": "definitions.json#/$defs/seriesComposition" },
"nightly": { "$ref": "definitions.json#/$defs/nightly" },
"tests": { "$ref": "definitions.json#/$defs/tests" },
"shortTitle": { "$ref": "definitions.json#/$defs/title" },
"organization": { "$ref": "definitions.json#/$defs/organization" },
"groups": { "$ref": "definitions.json#/$defs/groups" },
"forceCurrent": { "type": "boolean" },
"multipage": { "type": "boolean" }
},
Expand Down
2 changes: 2 additions & 0 deletions test/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const assert = require("assert");
const schema = require("../schema/data.json");
const dfnsSchema = require("../schema/definitions.json");
const Ajv = require("ajv");
const addFormats = require("ajv-formats")
const ajv = (new Ajv()).addSchema(dfnsSchema);
addFormats(ajv);

describe("Ignore/Monitor lists", () => {
describe("The JSON schema", () => {
Expand Down
3 changes: 3 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ const specs = require("../index.json");
const schema = require("../schema/index.json");
const dfnsSchema = require("../schema/definitions.json");
const Ajv = require("ajv");
const addFormats = require("ajv-formats")
const ajv = new Ajv();
addFormats(ajv);


describe("List of specs", () => {
it("has a valid JSON schema", () => {
Expand Down
22 changes: 12 additions & 10 deletions test/specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const dfnsSchema = require("../schema/definitions.json");
const computeInfo = require("../src/compute-shortname.js");
const computePrevNext = require("../src/compute-prevnext.js");
const Ajv = require("ajv");
const addFormats = require("ajv-formats")
const ajv = (new Ajv()).addSchema(dfnsSchema);
addFormats(ajv);

// When an entry is invalid, the schema validator returns one error for each
// "oneOf" option and one error on overall "oneOf" problem. This is confusing
Expand All @@ -22,9 +24,9 @@ function clarifyErrors(errors) {
return errors;
}

// Update dataPath to drop misleading "[object Object]"
// Update instancePath to drop misleading "[object Object]"
errors.forEach(err =>
err.dataPath = err.dataPath.replace(/^\[object Object\]/, ''));
err.instancePath = err.instancePath.replace(/^\[object Object\]/, ''));

if (errors.length < 2) {
return errors;
Expand All @@ -35,7 +37,7 @@ function clarifyErrors(errors) {
if ((errors[0].schemaPath === "#/items/oneOf/0/type") &&
(errors[1].schemaPath === "#/items/oneOf/1/type")) {
return [
Object.assign(errors[0], { "message": "should be a string or an object" })
Object.assign(errors[0], { "message": "must be a string or an object" })
];
}

Expand All @@ -59,7 +61,7 @@ function clarifyErrors(errors) {
clearerErrors.forEach(error => {
if ((error.keyword === "additionalProperties") &&
error.params && error.params.additionalProperty) {
error.message = "should not have additional property '" +
error.message = "must not have additional property '" +
error.params.additionalProperty + "'";
}
});
Expand Down Expand Up @@ -113,32 +115,32 @@ describe("Input list", () => {

it("rejects list if it is not an array", () => {
const specs = 0;
assert.strictEqual(check(specs), "specs should be array");
assert.strictEqual(check(specs), "specs must be array");
});

it("rejects an empty list", () => {
const specs = [];
assert.strictEqual(check(specs), "specs should NOT have fewer than 1 items");
assert.strictEqual(check(specs), "specs must NOT have fewer than 1 items");
});

it("rejects items that have a wrong type", () => {
const specs = [0];
assert.strictEqual(check(specs), "specs[0] should be a string or an object");
assert.strictEqual(check(specs), "specs/0 must be a string or an object");
});

it("rejects spec objects without URL", () => {
const specs = [{}];
assert.strictEqual(check(specs), "specs[0] should have required property 'url'");
assert.strictEqual(check(specs), "specs/0 must have required property 'url'");
});

it("rejects spec objects with an invalid URL", () => {
const specs = [{ url: "invalid" }];
assert.strictEqual(check(specs), "specs[0].url should match format \"uri\"");
assert.strictEqual(check(specs), "specs/0/url must match format \"uri\"");
});

it("rejects spec objects with additional properties", () => {
const specs = [{ url: "https://example.org/", invalid: "test" }];
assert.strictEqual(check(specs), "specs[0] should not have additional property 'invalid'");
assert.strictEqual(check(specs), "specs/0 must not have additional property 'invalid'");
});
});

Expand Down