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:


export declare function mergeOpenAPISpec<C extends Partial<OpenApiSpec>, P extends Partial<OpenApiSpec>>(currentSpec: C, patchSpec: P): C & P;


Parameter Type Description
currentSpec C The original spec
patchSpec P The patch spec to be merged into the original spec


C & P

A new specification object created by merging the original ones.