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

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

[Home](./index.md) &gt; [@loopback/openapi-spec-builder](./openapi-spec-builder.md) &gt; [ComponentsSpecBuilder](./openapi-spec-builder.componentsspecbuilder.md)

## ComponentsSpecBuilder class

A builder for creating ComponentsObject specifications.

**Signature:**

```typescript
export declare class ComponentsSpecBuilder extends BuilderBase<ComponentsObject> 
```
**Extends:** [BuilderBase](./openapi-spec-builder.builderbase.md)<!-- -->&lt;ComponentsObject&gt;

## Constructors

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

Constructor


</th><th>

Modifiers


</th><th>

Description


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

[(constructor)()](./openapi-spec-builder.componentsspecbuilder._constructor_.md)


</td><td>


</td><td>

Constructs a new instance of the `ComponentsSpecBuilder` class


</td></tr>
</tbody></table>

## Methods

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

Method


</th><th>

Modifiers


</th><th>

Description


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

[withCallback(name, callback)](./openapi-spec-builder.componentsspecbuilder.withcallback.md)


</td><td>


</td><td>

Define a component callback.


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

[withExample(name, example)](./openapi-spec-builder.componentsspecbuilder.withexample.md)


</td><td>


</td><td>

Define a component example.


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

[withHeader(name, header)](./openapi-spec-builder.componentsspecbuilder.withheader.md)


</td><td>


</td><td>

Define a component header.


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

[withLink(name, link)](./openapi-spec-builder.componentsspecbuilder.withlink.md)


</td><td>


</td><td>

Define a component link.


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

[withParameter(name, parameter)](./openapi-spec-builder.componentsspecbuilder.withparameter.md)


</td><td>


</td><td>

Define a component parameter.


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

[withRequestBody(name, requestBody)](./openapi-spec-builder.componentsspecbuilder.withrequestbody.md)


</td><td>


</td><td>

Define a component request body.


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

[withResponse(name, response)](./openapi-spec-builder.componentsspecbuilder.withresponse.md)


</td><td>


</td><td>

Define a component response.


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

[withSchema(name, schema)](./openapi-spec-builder.componentsspecbuilder.withschema.md)


</td><td>


</td><td>

Define a component schema.


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

[withSecurityScheme(name, securityScheme)](./openapi-spec-builder.componentsspecbuilder.withsecurityscheme.md)


</td><td>


</td><td>

Define a component security scheme.


</td></tr>
</tbody></table>

