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

openapi-merge

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-merge

A tool to merge numerous OpenAPI files into a single openapi definition.

  • 1.3.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
148K
decreased by-19%
Maintainers
2
Weekly downloads
 
Created

What is openapi-merge?

The openapi-merge npm package is designed to merge multiple OpenAPI (Swagger) specification files into a single file. This can be particularly useful for large projects where APIs are defined in separate files for modularity and need to be combined for documentation or other purposes.

What are openapi-merge's main functionalities?

Merge Multiple OpenAPI Files

This feature allows you to merge multiple OpenAPI specification files into a single file. The code sample demonstrates how to read two OpenAPI files, merge them using the openapi-merge package, and then write the merged result to a new file.

const { merge } = require('openapi-merge');
const fs = require('fs');

const file1 = JSON.parse(fs.readFileSync('path/to/openapi1.json', 'utf8'));
const file2 = JSON.parse(fs.readFileSync('path/to/openapi2.json', 'utf8'));

const merged = merge([file1, file2]);

fs.writeFileSync('path/to/merged-openapi.json', JSON.stringify(merged, null, 2));

Custom Merge Options

This feature allows you to specify custom options for the merge process. The code sample shows how to use an options object to customize the merging behavior, such as ignoring conflicts.

const { merge } = require('openapi-merge');
const fs = require('fs');

const file1 = JSON.parse(fs.readFileSync('path/to/openapi1.json', 'utf8'));
const file2 = JSON.parse(fs.readFileSync('path/to/openapi2.json', 'utf8'));

const options = {
  // Custom options for merging
  ignoreConflicts: true
};

const merged = merge([file1, file2], options);

fs.writeFileSync('path/to/merged-openapi.json', JSON.stringify(merged, null, 2));

Other packages similar to openapi-merge

Keywords

FAQs

Package last updated on 06 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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