---
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 markdown="1">

[(constructor)()](./openapi-spec-builder.componentsspecbuilder._constructor_.md)


</td><td markdown="1">


</td><td markdown="1">

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 markdown="1">

[withCallback(name, callback)](./openapi-spec-builder.componentsspecbuilder.withcallback.md)


</td><td markdown="1">


</td><td markdown="1">

Define a component callback.


</td></tr>
<tr><td markdown="1">

[withExample(name, example)](./openapi-spec-builder.componentsspecbuilder.withexample.md)


</td><td markdown="1">


</td><td markdown="1">

Define a component example.


</td></tr>
<tr><td markdown="1">

[withHeader(name, header)](./openapi-spec-builder.componentsspecbuilder.withheader.md)


</td><td markdown="1">


</td><td markdown="1">

Define a component header.


</td></tr>
<tr><td markdown="1">

[withLink(name, link)](./openapi-spec-builder.componentsspecbuilder.withlink.md)


</td><td markdown="1">


</td><td markdown="1">

Define a component link.


</td></tr>
<tr><td markdown="1">

[withParameter(name, parameter)](./openapi-spec-builder.componentsspecbuilder.withparameter.md)


</td><td markdown="1">


</td><td markdown="1">

Define a component parameter.


</td></tr>
<tr><td markdown="1">

[withRequestBody(name, requestBody)](./openapi-spec-builder.componentsspecbuilder.withrequestbody.md)


</td><td markdown="1">


</td><td markdown="1">

Define a component request body.


</td></tr>
<tr><td markdown="1">

[withResponse(name, response)](./openapi-spec-builder.componentsspecbuilder.withresponse.md)


</td><td markdown="1">


</td><td markdown="1">

Define a component response.


</td></tr>
<tr><td markdown="1">

[withSchema(name, schema)](./openapi-spec-builder.componentsspecbuilder.withschema.md)


</td><td markdown="1">


</td><td markdown="1">

Define a component schema.


</td></tr>
<tr><td markdown="1">

[withSecurityScheme(name, securityScheme)](./openapi-spec-builder.componentsspecbuilder.withsecurityscheme.md)


</td><td markdown="1">


</td><td markdown="1">

Define a component security scheme.


</td></tr>
</tbody></table>


