---
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.

**Signature:**

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

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

spec


</td><td>

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


</td><td>


</td></tr>
<tr><td>

schemeName


</td><td>

string


</td><td>

The name of the security scheme to be added


</td></tr>
<tr><td>

schemeSpec


</td><td>

SecuritySchemeObject


</td><td>

The security scheme spec body to be added,


</td></tr>
</tbody></table>
**Returns:**

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


