Skip to content

Commit f3a8aa7

Browse files
committed
Update to latest version of json-schema
1 parent 31b120a commit f3a8aa7

File tree

14 files changed

+76
-486
lines changed

14 files changed

+76
-486
lines changed

.github/workflows/node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
node-version: [16.x]
1717

1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
- name: Use Node.js ${{ matrix.node-version }}
2121
uses: actions/setup-node@v3
2222
with:

_schemas/1.0/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "http://json-schema.org/draft-07/schema#",
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "https://jsonapi.org/schemas/spec/v1.0/draft",
44
"$comment": "The $id URI should be modified before releasing. This URI does not need to be network addressable. It is an ID only.",
55
"title": "JSON:API Schema",

_schemas/1.0/schema_create_resource.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "http://json-schema.org/draft-07/schema#",
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "https://jsonapi.org/schemas/spec/v1.0/draft/create/resource",
44
"$comment": "The $id URI should be modified before releasing. This URI does not need to be network addressable. It is an ID only.",
55
"title": "JSON:API Schema for POST request",

_schemas/1.0/schema_update_relationship.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "http://json-schema.org/draft-07/schema#",
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "https://jsonapi.org/schemas/spec/v1.0/draft/update/relationship",
44
"$comment": "The $id URI should be modified before releasing. This URI does not need to be network addressable. It is an ID only.",
55
"title": "JSON:API Schema for POST request",

_schemas/1.0/schema_update_resource.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "http://json-schema.org/draft-07/schema#",
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "https://jsonapi.org/schemas/spec/v1.0/draft/update/resource",
44
"$comment": "The $id URI should be modified before releasing. This URI does not need to be network addressable. It is an ID only.",
55
"title": "JSON:API Schema for POST request",

_schemas/scripts/validator.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// Import the modules
2-
const Ajv = require("ajv");
32
const Ajv2020 = require("ajv/dist/2020");
43
const addFormats = require("ajv-formats");
54
const readdirp = require("readdirp");
65
const npath = require("path");
7-
const compareVersions = require("compare-versions");
6+
const { compareVersions } = require("compare-versions");
87

98
/**
109
* Retrieve the value of the given option.
@@ -74,7 +73,7 @@ const options = {
7473
console.log("");
7574

7675
// ... create ajv instance
77-
const ajv = ajvFactory(version);
76+
const ajv = ajvFactory();
7877

7978
// ... add schemas to ajv instance
8079
await addSchemas(ajv, version);
@@ -110,12 +109,11 @@ const options = {
110109

111110
/**
112111
* Generate new instance of Ajv validator.
113-
* @param {String} version - The version of the JSON:API spec that will be validated
114-
* @returns {Ajv|Ajv2020} - An in stance of Ajv validator
112+
* @returns {Ajv2020} - An instance of Ajv validator
115113
*/
116-
const ajvFactory = function (version) {
114+
const ajvFactory = function () {
117115
// ... create ajv instance
118-
const ajv = (version === "1.0") ? new Ajv() : new Ajv2020();
116+
const ajv = new Ajv2020();
119117

120118
// ...add formats to ajv validator
121119
addFormats(ajv);
@@ -125,7 +123,7 @@ const ajvFactory = function (version) {
125123

126124
/**
127125
* Load all version-related schemas and register them with the instance of the Ajv validator.
128-
* @param {Ajv|Ajv2020} ajv - An instance of Ajv validator
126+
* @param {Ajv2020} ajv - An instance of Ajv validator
129127
* @param {String} version - The version of the JSON:API spec that will be validated
130128
* @return {void}
131129
*/
@@ -156,7 +154,7 @@ const addSchemas = async function (ajv, version) {
156154

157155
/**
158156
* Check all the test files for the given version of the JSON:API spec.
159-
* @param {Ajv|Ajv2020} ajv - An instance of Ajv validator
157+
* @param {Ajv2020} ajv - An instance of Ajv validator
160158
* @param {String} version - The version of the JSON:API spec that will be validated
161159
* @return {{ok: String[], ko: String[]}} - The results of the tests.
162160
*/
@@ -178,7 +176,7 @@ const handleTests = async function (ajv, version) {
178176

179177
/**
180178
* Check all the test files for the given version of the JSON:API spec.
181-
* @param {Ajv|Ajv2020} ajv - An instance of Ajv validator
179+
* @param {Ajv2020} ajv - An instance of Ajv validator
182180
* @param {String} version - The version of the JSON:API spec that will be validated
183181
* @param {{ok: String[], ko: String[]}} results - The results of the tests.
184182
* @return {void}
@@ -206,7 +204,7 @@ const runAllTests = async function (ajv, version, results) {
206204

207205
/**
208206
* Run a single test for the given version of the JSON:API spec and the test file that was passed in the options.
209-
* @param {Ajv|Ajv2020} ajv - An instance of Ajv validator
207+
* @param {Ajv2020} ajv - An instance of Ajv validator
210208
* @param {String} version - The version of the JSON:API spec that will be validated
211209
* @param {{ok: String[], ko: String[]}} results - The result of the test.
212210
* @return {void}
@@ -231,7 +229,7 @@ const runSingleTest = async function (ajv, version, results) {
231229

232230
/**
233231
* Check a single test files for the given version of the JSON:API spec.
234-
* @param {Ajv|Ajv2020} ajv - An instance of Ajv validator
232+
* @param {Ajv2020} ajv - An instance of Ajv validator
235233
* @param {String} version - The version of the JSON:API spec that will be validated
236234
* @param {String} relativePath - The relative path of the test file that will be validated
237235
* @param {String} fullPath - The absolute path of the test file that will be validated
@@ -275,7 +273,7 @@ const readTestDir = async function (version, callback) {
275273

276274
/**
277275
* validate a test file for the given version of the JSON:API spec.
278-
* @param {Ajv|Ajv2020} ajv - An instance of Ajv validator
276+
* @param {Ajv2020} ajv - An instance of Ajv validator
279277
* @param {String} version - The version of the JSON:API spec that will be validated
280278
* @param {String} relativePath - The relative path of the file to validate.
281279
* @param {String} fullPath - The absolute path of the file to validate.

node_modules/.package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/compare-versions/README.md

Lines changed: 32 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/compare-versions/index.d.ts

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy