@json-schema-tools/reference-resolver
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -44,3 +44,3 @@ "use strict"; | ||
var isomorphic_fetch_1 = __importDefault(require("isomorphic-fetch")); | ||
var fetchHandler = function (uri, root) { return __awaiter(void 0, void 0, void 0, function () { | ||
var fetchHandler = function (uri) { return __awaiter(void 0, void 0, void 0, function () { | ||
var schemaReq, e_1, e_2; | ||
@@ -51,3 +51,3 @@ return __generator(this, function (_a) { | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, isomorphic_fetch_1.default(uri)]; | ||
return [4 /*yield*/, (0, isomorphic_fetch_1.default)(uri)]; | ||
case 1: | ||
@@ -54,0 +54,0 @@ schemaReq = _a.sent(); |
@@ -25,4 +25,4 @@ "use strict"; | ||
"NonJsonRefError", | ||
"The resolved value at the reference: " + obj.$ref + " was not JSON.parse 'able", | ||
"The non-json content in question: " + nonJson, | ||
"The resolved value at the reference: ".concat(obj.$ref, " was not JSON.parse 'able"), | ||
"The non-json content in question: ".concat(nonJson), | ||
].join("\n"); | ||
@@ -38,3 +38,3 @@ } | ||
"NotResolvableError", | ||
"Could not resolve the reference: " + ref, | ||
"Could not resolve the reference: ".concat(ref), | ||
"No protocol handler was found, and it was not found to be an internal reference", | ||
@@ -55,3 +55,3 @@ ].join("\n"); | ||
"InvalidRemoteURLError", | ||
"The url was not resolvable: " + ref, | ||
"The url was not resolvable: ".concat(ref), | ||
].join("\n"); | ||
@@ -82,3 +82,3 @@ } | ||
"InvalidFileSystemPathError", | ||
"The path was not resolvable: " + ref, | ||
"The path was not resolvable: ".concat(ref), | ||
].join("\n"); | ||
@@ -85,0 +85,0 @@ } |
@@ -15,3 +15,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -105,3 +109,3 @@ if (k2 === undefined) k2 = k; | ||
if (_a) | ||
filePath = path_1.default.parse(ref).dir + "/" + uri; | ||
filePath = "".concat(path_1.default.parse(ref).dir, "/").concat(uri); | ||
return [4 /*yield*/, fileExistsAndReadable(filePath)]; | ||
@@ -108,0 +112,0 @@ case 3: |
@@ -47,3 +47,2 @@ "use strict"; | ||
}; | ||
; | ||
var ReferenceResolver = /** @class */ (function () { | ||
@@ -67,3 +66,3 @@ function ReferenceResolver(protocolHandlerMap) { | ||
if (ref[0] === "#") { | ||
return [2 /*return*/, Promise.resolve(resolve_pointer_1.default(ref, root))]; | ||
return [2 /*return*/, Promise.resolve((0, resolve_pointer_1.default)(ref, root))]; | ||
} | ||
@@ -89,3 +88,3 @@ hashFragmentSplit = ref.split("#"); | ||
if (hashFragment) { | ||
schema = resolve_pointer_1.default(hashFragment, schema); | ||
schema = (0, resolve_pointer_1.default)(hashFragment, schema); | ||
} | ||
@@ -109,3 +108,3 @@ return [2 /*return*/, schema]; | ||
if (hashFragment) { | ||
schema = resolve_pointer_1.default(hashFragment, schema); | ||
schema = (0, resolve_pointer_1.default)(hashFragment, schema); | ||
} | ||
@@ -112,0 +111,0 @@ return [2 /*return*/, schema]; |
@@ -17,3 +17,3 @@ "use strict"; | ||
"InvalidJsonPointerRefError", | ||
"The provided RFC6901 JSON Pointer is invalid: " + ref, | ||
"The provided RFC6901 JSON Pointer is invalid: ".concat(ref), | ||
"", | ||
@@ -20,0 +20,0 @@ "addition info: ", |
{ | ||
"name": "@json-schema-tools/reference-resolver", | ||
"version": "1.2.4", | ||
"description": "", | ||
"version": "1.2.5", | ||
"description": "Turns a $ref into a JSONSchema", | ||
"main": "build/index.js", | ||
@@ -13,3 +13,4 @@ "browser": "build/index-web.js", | ||
"build:code": "tsc", | ||
"lint": "tslint --fix -p .", | ||
"lint": "eslint . --ext .ts", | ||
"lint:fix": "eslint . --ext .ts --fix", | ||
"test": "npm run test:unit && npm run test:web", | ||
@@ -33,13 +34,15 @@ "test:unit": "npm run lint && jest --coverage", | ||
"devDependencies": { | ||
"@json-schema-tools/meta-schema": "^1.6.18", | ||
"@types/isomorphic-fetch": "0.0.35", | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^15.12.2", | ||
"jest": "^24.9.0", | ||
"ts-jest": "^24.3.0", | ||
"tslint": "^6.1.3", | ||
"typedoc": "^0.21.0", | ||
"typescript": "4.3.4", | ||
"webpack": "^5.38.1", | ||
"webpack-cli": "^4.7.2" | ||
"@json-schema-tools/meta-schema": "^1.7.0", | ||
"@types/isomorphic-fetch": "^0.0.36", | ||
"@types/jest": "^29.1.1", | ||
"@types/node": "^18.8.2", | ||
"@typescript-eslint/eslint-plugin": "^5.39.0", | ||
"@typescript-eslint/parser": "^5.39.0", | ||
"eslint": "^8.24.0", | ||
"jest": "^29.1.2", | ||
"ts-jest": "^29.0.3", | ||
"typedoc": "^0.23.15", | ||
"typescript": "^4.8.4", | ||
"webpack": "^5.74.0", | ||
"webpack-cli": "^4.10.0" | ||
}, | ||
@@ -46,0 +49,0 @@ "dependencies": { |
@@ -7,3 +7,2 @@ # JSON Schema Reference Resolver | ||
<img src="https://codecov.io/gh/json-schema-tools/reference-resolver/branch/master/graph/badge.svg" /> | ||
<img alt="Dependabot status" src="https://api.dependabot.com/badges/status?host=github&repo=json-schema-tools/reference-resolver" /> | ||
<img alt="npm" src="https://img.shields.io/npm/dt/@json-schema-tools/reference-resolver.svg" /> | ||
@@ -41,3 +40,3 @@ <img alt="GitHub release" src="https://img.shields.io/github/release/json-schema-tools/reference-resolver.svg" /> | ||
const pretendItsFetchedFromIpfs = { | ||
title: "foo", | ||
title: "foo", | ||
type: "string", | ||
@@ -49,4 +48,4 @@ } as JSONSchema; | ||
referenceResolver.protocolHandlerMap["customprotocol"] = (uri) => { | ||
return Promise.resolve({ | ||
type: "string", | ||
return Promise.resolve({ | ||
type: "string", | ||
title: uri.replace("customprotocol://", ""), | ||
@@ -53,0 +52,0 @@ }); |
41960
578
13
60