Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oas-resolver

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oas-resolver - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

28

index.js

@@ -46,3 +46,3 @@ 'use strict';

let target = clone(jptr(context, obj[key]));
if (options.verbose>1) console.log((target === false ? common.colour.red : common.colour.green)+'Fragment resolution', obj[key], common.colour.normal);
if (options.verbose>1) console.warn((target === false ? common.colour.red : common.colour.green)+'Fragment resolution', obj[key], common.colour.normal);
/*

@@ -72,3 +72,3 @@ ResolutionCase:A is where there is a local reference in an externally

state.parent[state.pkey] = { $ref: newRef, 'x-miro': obj[key], $fixed: true };
if (options.verbose>1) console.log('Replacing with',newRef);
if (options.verbose>1) console.warn('Replacing with',newRef);
changes++;

@@ -85,3 +85,3 @@ }

let newRef = url.resolve(base,obj[key]).toString();
if (options.verbose>1) console.log(common.colour.yellow+'Rewriting external url ref',obj[key],'as',newRef,common.colour.normal);
if (options.verbose>1) console.warn(common.colour.yellow+'Rewriting external url ref',obj[key],'as',newRef,common.colour.normal);
obj['x-miro'] = obj[key];

@@ -92,3 +92,3 @@ obj[key] = newRef;

let newRef = url.resolve(base,obj[key]).toString();
if (options.verbose>1) console.log(common.colour.yellow+'Rewriting external ref',obj[key],'as',newRef,common.colour.normal);
if (options.verbose>1) console.warn(common.colour.yellow+'Rewriting external ref',obj[key],'as',newRef,common.colour.normal);
obj['x-miro'] = obj[key]; // we use x-miro as a flag so we don't do this > once

@@ -108,3 +108,3 @@ obj[key] = newRef;

if (options.verbose>1) console.log('Finished fragment resolution');
if (options.verbose>1) console.warn('Finished fragment resolution');
return obj;

@@ -146,3 +146,3 @@ }

if (options.cache[target]) {
if (options.verbose) console.log('CACHED', target, fragment);
if (options.verbose) console.warn('CACHED', target, fragment);
/*

@@ -171,3 +171,3 @@ resolutionSource:A this is where we have cached the externally-referenced document from a

if (options.verbose) console.log('GET', target, fragment);
if (options.verbose) console.warn('GET', target, fragment);

@@ -298,3 +298,3 @@ if (options.handlers && options.handlers[effectiveProtocol]) {

let newRef = refs[$ref].resolvedAt;
if (options.verbose>1) console.log('Rewriting ref', $ref, newRef);
if (options.verbose>1) console.warn('Rewriting ref', $ref, newRef);
obj[key]['x-miro'] = $ref;

@@ -375,3 +375,3 @@ obj[key].$ref = newRef+$extra; // resolutionCase:C (new string)

if (refs[ref].resolvedAt && (ptr !== refs[ref].resolvedAt) && (ptr.indexOf('x-ms-examples/')<0)) {
if (options.verbose>1) console.log('Creating pointer to data at', ptr);
if (options.verbose>1) console.warn('Creating pointer to data at', ptr);
jptr(options.openapi, ptr, { $ref: refs[ref].resolvedAt+refs[ref].extras[ptr], 'x-miro': ref+refs[ref].extras[ptr] }); // resolutionCase:E (new object)

@@ -381,7 +381,7 @@ }

if (refs[ref].resolvedAt) {
if (options.verbose>1) console.log('Avoiding circular reference');
if (options.verbose>1) console.warn('Avoiding circular reference');
}
else {
refs[ref].resolvedAt = ptr;
if (options.verbose>1) console.log('Creating initial clone of data at', ptr);
if (options.verbose>1) console.warn('Creating initial clone of data at', ptr);
}

@@ -433,7 +433,7 @@ let cdata = clone(data);

else {
if (options.verbose>1) console.log(common.colour.yellow+'Finished external resolution!',common.colour.normal);
if (options.verbose>1) console.warn(common.colour.yellow+'Finished external resolution!',common.colour.normal);
if (options.resolveInternal) {
if (options.verbose>1) console.log(common.colour.yellow+'Starting internal resolution!',common.colour.normal);
if (options.verbose>1) console.warn(common.colour.yellow+'Starting internal resolution!',common.colour.normal);
options.openapi = deRef(options.openapi,options.original,{verbose:options.verbose-1});
if (options.verbose>1) console.log(common.colour.yellow+'Finished internal resolution!',common.colour.normal);
if (options.verbose>1) console.warn(common.colour.yellow+'Finished internal resolution!',common.colour.normal);
}

@@ -440,0 +440,0 @@ res(options);

{
"name": "oas-resolver",
"version": "2.2.0",
"version": "2.2.1",
"description": "Resolve external $refs in OpenAPI (swagger) 2.0 / 3.x definitions",

@@ -24,5 +24,5 @@ "main": "index.js",

"oas-kit-common": "^1.0.7",
"reftools": "^1.0.6",
"yaml": "^1.2.0",
"yargs": "^12.0.2"
"reftools": "^1.0.7",
"yaml": "^1.3.1",
"yargs": "^12.0.5"
},

@@ -36,3 +36,3 @@ "repository": {

},
"gitHead": "513fe4b718c35783334dba8c7becaa49aec40ce9"
"gitHead": "229b07984cc88bce1d40aa984c5f73eeac3acb1a"
}

@@ -55,3 +55,3 @@ #!/usr/bin/env node

if (filespec && filespec.startsWith('http')) {
console.log('GET ' + filespec);
console.warn('GET ' + filespec);
fetch(filespec, {agent:options.agent}).then(function (res) {

@@ -58,0 +58,0 @@ if (res.status !== 200) throw new Error(`Received status code ${res.status}`);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc