@json-schema-tools/referencer 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +8 -8
- package/package.json +12 -12
- package/CHANGELOG.md +0 -53
package/build/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var stringifyCircular = function (obj) {
|
|
|
25
25
|
return JSON.stringify(obj, function (key, value) {
|
|
26
26
|
if (typeof value === "object" && value !== null) {
|
|
27
27
|
if (cache.indexOf(value) !== -1) {
|
|
28
|
-
return "[Circular: "
|
|
28
|
+
return "[Circular: ".concat(value.title ? value.title : "NoTitle", "]");
|
|
29
29
|
}
|
|
30
30
|
cache.push(value);
|
|
31
31
|
}
|
|
@@ -42,13 +42,13 @@ var NoTitleError = /** @class */ (function () {
|
|
|
42
42
|
schemaStr = JSON.stringify(schema);
|
|
43
43
|
}
|
|
44
44
|
catch (e) {
|
|
45
|
-
schemaStr = exports.stringifyCircular(schema);
|
|
45
|
+
schemaStr = (0, exports.stringifyCircular)(schema);
|
|
46
46
|
}
|
|
47
47
|
try {
|
|
48
48
|
parentSchemaStr = JSON.stringify(parentSchema);
|
|
49
49
|
}
|
|
50
50
|
catch (e) {
|
|
51
|
-
parentSchemaStr = exports.stringifyCircular(parentSchema);
|
|
51
|
+
parentSchemaStr = (0, exports.stringifyCircular)(parentSchema);
|
|
52
52
|
}
|
|
53
53
|
this.message = [
|
|
54
54
|
"Title is required on subschemas.",
|
|
@@ -81,24 +81,24 @@ exports.NoTitleError = NoTitleError;
|
|
|
81
81
|
*/
|
|
82
82
|
function referencer(s) {
|
|
83
83
|
var definitions = {};
|
|
84
|
-
traverse_1.default(s, function (subSchema, isRootCycle) {
|
|
84
|
+
(0, traverse_1.default)(s, function (subSchema, isRootCycle) {
|
|
85
85
|
var t = "";
|
|
86
86
|
if (isRootCycle && subSchema !== true && subSchema !== false) {
|
|
87
87
|
if (subSchema.$ref) {
|
|
88
88
|
var title = subSchema.$ref.replace("#/definitions/", "");
|
|
89
89
|
var hasDefForRef = definitions[title];
|
|
90
90
|
if (hasDefForRef === undefined) {
|
|
91
|
-
throw new Error("Encountered unknown $ref: "
|
|
91
|
+
throw new Error("Encountered unknown $ref: ".concat(subSchema.$ref));
|
|
92
92
|
}
|
|
93
93
|
return subSchema;
|
|
94
94
|
}
|
|
95
95
|
if (subSchema === s) {
|
|
96
96
|
definitions[s.title] = { $ref: "#" };
|
|
97
|
-
return { $ref: "#/definitions/"
|
|
97
|
+
return { $ref: "#/definitions/".concat(s.title) };
|
|
98
98
|
}
|
|
99
99
|
definitions[subSchema.title] = __assign({}, subSchema);
|
|
100
100
|
deleteAllProps(subSchema);
|
|
101
|
-
subSchema.$ref = "#/definitions/"
|
|
101
|
+
subSchema.$ref = "#/definitions/".concat(subSchema.title);
|
|
102
102
|
return subSchema;
|
|
103
103
|
}
|
|
104
104
|
if (subSchema === true) {
|
|
@@ -119,7 +119,7 @@ function referencer(s) {
|
|
|
119
119
|
t = subSchema.title;
|
|
120
120
|
definitions[t] = __assign({}, subSchema);
|
|
121
121
|
deleteAllProps(subSchema);
|
|
122
|
-
subSchema.$ref = "#/definitions/"
|
|
122
|
+
subSchema.$ref = "#/definitions/".concat(t);
|
|
123
123
|
}
|
|
124
124
|
return subSchema;
|
|
125
125
|
}, { mutable: true, skipFirstMutation: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@json-schema-tools/referencer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"!build/**/*.test.*"
|
|
27
27
|
],
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@json-schema-tools/meta-schema": "^1.
|
|
30
|
-
"@types/jest": "^
|
|
31
|
-
"@types/node": "^
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
33
|
-
"@typescript-eslint/parser": "^
|
|
34
|
-
"eslint": "^
|
|
35
|
-
"jest": "^
|
|
36
|
-
"ts-jest": "^
|
|
37
|
-
"typedoc": "^0.
|
|
38
|
-
"typescript": "4.
|
|
29
|
+
"@json-schema-tools/meta-schema": "^1.7.0",
|
|
30
|
+
"@types/jest": "^29.2.0",
|
|
31
|
+
"@types/node": "^18.11.7",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^5.41.0",
|
|
33
|
+
"@typescript-eslint/parser": "^5.41.0",
|
|
34
|
+
"eslint": "^8.26.0",
|
|
35
|
+
"jest": "^29.2.2",
|
|
36
|
+
"ts-jest": "^29.0.3",
|
|
37
|
+
"typedoc": "^0.23.18",
|
|
38
|
+
"typescript": "^4.8.4"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@json-schema-tools/traverse": "^1.
|
|
41
|
+
"@json-schema-tools/traverse": "^1.10.1"
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/json-schema-tools/referencer#readme",
|
|
44
44
|
"description": "Get a copy of a JSON Schema where all subschemas are turned into `$ref`s with corresponding definitions section."
|
package/CHANGELOG.md
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
## [1.0.5](https://github.com/json-schema-tools/referencer/compare/1.0.4...1.0.5) (2021-06-24)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* update to new meta-schema ([521cb6f](https://github.com/json-schema-tools/referencer/commit/521cb6fc253040d6dda4b9f657fe18697b9e8891))
|
|
7
|
-
|
|
8
|
-
## [1.0.4](https://github.com/json-schema-tools/referencer/compare/1.0.3...1.0.4) (2021-06-08)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Bug Fixes
|
|
12
|
-
|
|
13
|
-
* linting fixup ([04d6243](https://github.com/json-schema-tools/referencer/commit/04d62436e0e40348d4fe5dcc1d14901f4ebcdab2))
|
|
14
|
-
* update deps ([7bfb05b](https://github.com/json-schema-tools/referencer/commit/7bfb05b7cee8ef07de40cd8187b437b20a25ff22))
|
|
15
|
-
|
|
16
|
-
## [1.0.3](https://github.com/json-schema-tools/referencer/compare/1.0.2...1.0.3) (2020-11-03)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
### Bug Fixes
|
|
20
|
-
|
|
21
|
-
* add docs ([a67a07f](https://github.com/json-schema-tools/referencer/commit/a67a07f1e7aa96e86edee05a2800092d5f8189cc))
|
|
22
|
-
|
|
23
|
-
## [1.0.2](https://github.com/json-schema-tools/referencer/compare/1.0.1...1.0.2) (2020-10-23)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### Bug Fixes
|
|
27
|
-
|
|
28
|
-
* add funding ([606b55b](https://github.com/json-schema-tools/referencer/commit/606b55b4d2170c412aa7b3e5ba19098b98a8e1bd))
|
|
29
|
-
|
|
30
|
-
## [1.0.1](https://github.com/json-schema-tools/referencer/compare/1.0.0...1.0.1) (2020-10-23)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### Bug Fixes
|
|
34
|
-
|
|
35
|
-
* add pristine items ([9f68961](https://github.com/json-schema-tools/referencer/commit/9f689612c9975b53eec21e7bf9b797a23611e88a))
|
|
36
|
-
* lock node version ([7ee46e8](https://github.com/json-schema-tools/referencer/commit/7ee46e8dc5da95055eff24412d2870ccf8ae1c5e))
|
|
37
|
-
* remove dependabot badge ([adb559f](https://github.com/json-schema-tools/referencer/commit/adb559f23701c0727ac77b850af1920ee0668512))
|
|
38
|
-
* update all deps ([ecc2d58](https://github.com/json-schema-tools/referencer/commit/ecc2d584946d03ca981d8c9dbae1fdf6d54a1a23))
|
|
39
|
-
* update eslint ([2862bcb](https://github.com/json-schema-tools/referencer/commit/2862bcbf5591fd7c8fbffd6f762cd5a6858504ff))
|
|
40
|
-
* update readme ([a6702e6](https://github.com/json-schema-tools/referencer/commit/a6702e6d060a847eb6ca80763eb68b096807842e))
|
|
41
|
-
|
|
42
|
-
# 1.0.0 (2020-08-29)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
### Bug Fixes
|
|
46
|
-
|
|
47
|
-
* build stuff ([d669ace](https://github.com/json-schema-tools/referencer/commit/d669acee8ed69f659d78bad3ab3d6d080ca5bdaa))
|
|
48
|
-
* tests working ([94f270e](https://github.com/json-schema-tools/referencer/commit/94f270e063cca68e4c0cc6790d749b685b3e4269))
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
### Features
|
|
52
|
-
|
|
53
|
-
* first ([cf7d97a](https://github.com/json-schema-tools/referencer/commit/cf7d97a694be116376e7eccdb1ae370af2affe58))
|