Comparing version 2.5.1 to 2.5.2
@@ -16,2 +16,3 @@ "use strict"; | ||
const json_schema_resolve_ref_1 = require("../../utils/json-schema-resolve-ref"); | ||
const jsonPaths = __importStar(require("../../utils/jsonPaths")); | ||
const jsonSchema = __importStar(require("../../utils/jsonSchema")); | ||
@@ -177,3 +178,8 @@ const mime_1 = require("../../utils/mime"); | ||
if (node.$ref) { | ||
node.$ref = `#/properties/value/${node.$ref.slice(2)}`; | ||
if (node.$ref.startsWith('#')) { | ||
node.$ref = `#/properties/value/${node.$ref.slice(2)}`; | ||
} | ||
else { | ||
node.$ref = jsonPaths.toUriFragment(`/properties/value/${node.$ref.slice(1)}`); | ||
} | ||
} | ||
@@ -180,0 +186,0 @@ }); |
@@ -0,2 +1,3 @@ | ||
export declare function toUriFragment(path: string): string; | ||
export declare function jsonPointerStartsWith(path: string, prefix: string): boolean; | ||
export declare function jsonPointerStripPrefix(path: string, prefix: string): string; |
@@ -14,2 +14,6 @@ "use strict"; | ||
} | ||
function toUriFragment(path) { | ||
return jsonPtr.encodeUriFragmentIdentifier(jsonPtr.decode(path)); | ||
} | ||
exports.toUriFragment = toUriFragment; | ||
function jsonPointerStartsWith(path, prefix) { | ||
@@ -22,6 +26,13 @@ path = normalize(path); | ||
function jsonPointerStripPrefix(path, prefix) { | ||
const isUriFragment = path.startsWith('#'); | ||
path = normalize(path); | ||
prefix = normalize(prefix); | ||
if (path.startsWith(prefix)) { | ||
return path.slice(prefix.length); | ||
const answer = path.slice(prefix.length); | ||
if (isUriFragment) { | ||
return toUriFragment(answer); | ||
} | ||
else { | ||
return answer; | ||
} | ||
} | ||
@@ -28,0 +39,0 @@ else { |
{ | ||
"name": "exegesis", | ||
"version": "2.5.1", | ||
"version": "2.5.2", | ||
"description": "Parses OpenAPI documents", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
307733
4775