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

openapi-merge-cli

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-merge-cli - npm Package Compare versions

Comparing version 1.1.18 to 1.1.20

40

dist/index.js

@@ -25,2 +25,3 @@ "use strict";

const isomorphic_fetch_1 = __importDefault(require("isomorphic-fetch"));
const js_yaml_1 = __importDefault(require("js-yaml"));
const ERROR_LOADING_CONFIG = 1;

@@ -46,2 +47,39 @@ const ERROR_LOADING_INPUTS = 2;

}
function readFilePromise(filePath) {
return new Promise((resolve, reject) => {
fs_1.default.readFile(filePath, (err, result) => {
if (err) {
reject(err);
}
else {
resolve(result);
}
});
});
}
class JsonOrYamlParseError extends Error {
constructor(jsonError, yamlError) {
super(`Failed to parse the input as either JSON or YAML.\n\nJSON Error: ${jsonError.message}\n\nYAML Error: ${yamlError.message}`);
}
}
function readYamlOrJSON(filePath) {
return __awaiter(this, void 0, void 0, function* () {
const fileContents = (yield readFilePromise(filePath)).toString('utf-8');
let jsonError;
try {
return JSON.parse(fileContents);
}
catch (e) {
jsonError = e;
}
let yamlError;
try {
return js_yaml_1.default.safeLoad(fileContents);
}
catch (e) {
yamlError = e;
}
throw new JsonOrYamlParseError(jsonError, yamlError);
});
}
function loadOasForInput(basePath, input, inputIndex, logger) {

@@ -52,3 +90,3 @@ return __awaiter(this, void 0, void 0, function* () {

logger.log(`## Loading input ${inputIndex}: ${fullPath}`);
return JSON.parse(fs_1.default.readFileSync(fullPath).toString('utf-8'));
return (yield readYamlOrJSON(fullPath));
}

@@ -55,0 +93,0 @@ else {

4

package.json
{
"name": "openapi-merge-cli",
"version": "1.1.18",
"version": "1.1.20",
"description": "A cli tool for the openapi-merge library.",

@@ -32,2 +32,3 @@ "keywords": [

"@types/isomorphic-fetch": "^0.0.35",
"@types/js-yaml": "^3.12.5",
"@types/node": "^13.13.5",

@@ -47,2 +48,3 @@ "@typescript-eslint/eslint-plugin": "2.31.0",

"isomorphic-fetch": "^2.2.1",
"js-yaml": "^3.14.0",
"openapi-merge": "^1.0.22"

@@ -49,0 +51,0 @@ },

@@ -32,3 +32,3 @@ # openapi-merge-cli

{
"inputFile": "./confluence.swagger.json",
"inputFile": "./confluence.swagger.yaml",
"disputePrefix": "Confluence",

@@ -49,3 +49,3 @@ "pathModification": {

* `inputFile` or `inputURL`: the relative path (or URL), from the `openapi-merge.json`, to the OpenAPI schema file for that input.
* `inputFile` or `inputURL`: the relative path (or URL), from the `openapi-merge.json`, to the OpenAPI schema file for that input (in JSON or Yaml format).
* `disputePrefix`: if two inputs both define a component with the same name then, in order to prevent incorrect overlaps, we will attempt to use the dispute prefix to come up with a unique name for that component.

@@ -52,0 +52,0 @@ * `pathModification.stripStart`: When copying over the `paths` from your OpenAPI specification for this input, it will strip this string from the start of the path if it is found.

Sorry, the diff of this file is not supported yet

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