---
lang: en
title: 'API docs: openapi-v3.mergesecurityschemetospec'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/openapi-v3
permalink: /doc/en/lb4/apidocs.openapi-v3.mergesecurityschemetospec.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/openapi-v3](./openapi-v3.md) &gt; [mergeSecuritySchemeToSpec](./openapi-v3.mergesecurityschemetospec.md)

## mergeSecuritySchemeToSpec() function

Security scheme merge helper function to patch the current OpenAPI spec. It provides a direct route to add a security schema to the specs components. It returns a new merged object without modifying the original one.

<b>Signature:</b>

```typescript
export declare function mergeSecuritySchemeToSpec(spec: OpenApiSpec, schemeName: string, schemeSpec: SecuritySchemeObject): OpenApiSpec;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  spec | [OpenApiSpec](./openapi-v3.openapispec.md) |  |
|  schemeName | string | The name of the security scheme to be added |
|  schemeSpec | SecuritySchemeObject | The security scheme spec body to be added, |

<b>Returns:</b>

[OpenApiSpec](./openapi-v3.openapispec.md)


