Page Contents

Home > @loopback/openapi-v3 > mergeOpenAPISpec

mergeOpenAPISpec() function

The default merge function to patch the current OpenAPI spec. It leverages module json-merge-patch’s merge API to merge two json objects. It returns a new merged object without modifying the original one.

A list of merging rules can be found in test file: https://github.com/pierreinglebert/json-merge-patch/blob/master/test/lib/merge.js

Signature:

export declare function mergeOpenAPISpec(currentSpec: Partial<OpenApiSpec>, patchSpec: Partial<OpenApiSpec>): any;

Parameters

Parameter Type Description
currentSpec Partial<OpenApiSpec> The original spec
patchSpec Partial<OpenApiSpec> The patch spec to be merged into the original spec

Returns:

any