---
lang: en
title: 'API docs: openapi-spec-builder.openapispecbuilder'
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.openapispecbuilder.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; [OpenApiSpecBuilder](./openapi-spec-builder.openapispecbuilder.md)

## OpenApiSpecBuilder class

A builder for creating OpenApiSpec documents.

**Signature:**

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

## Constructors

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

Constructor


</th><th>

Modifiers


</th><th>

Description


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

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


</td><td>


</td><td>

Constructs a new instance of the `OpenApiSpecBuilder` class


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

## Methods

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

Method


</th><th>

Modifiers


</th><th>

Description


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

[withComponents(spec)](./openapi-spec-builder.openapispecbuilder.withcomponents.md)


</td><td>


</td><td>

Define a new ComponentsObject.


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

[withOperation(verb, path, spec)](./openapi-spec-builder.openapispecbuilder.withoperation.md)


</td><td>


</td><td>

Define a new OperationObject at the given path and verb (method).


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

[withOperationReturningString(verb, path, operationName)](./openapi-spec-builder.openapispecbuilder.withoperationreturningstring.md)


</td><td>


</td><td>

Define a new operation that returns a string response.


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


