@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
38 lines (24 loc) • 1.4 kB
Markdown
---
lang: en
title: 'API docs: openapi-v3.mergeopenapispec'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/openapi-v3
permalink: /doc/en/lb4/apidocs.openapi-v3.mergeopenapispec.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/openapi-v3](./openapi-v3.md) > [mergeOpenAPISpec](./openapi-v3.mergeopenapispec.md)
## 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
<b>Signature:</b>
```typescript
export declare function mergeOpenAPISpec(currentSpec: Partial<OpenApiSpec>, patchSpec: Partial<OpenApiSpec>): any;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| currentSpec | Partial<[OpenApiSpec](./openapi-v3.openapispec.md)<!-- -->> | The original spec |
| patchSpec | Partial<[OpenApiSpec](./openapi-v3.openapispec.md)<!-- -->> | The patch spec to be merged into the original spec |
<b>Returns:</b>
any