---
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/strongloop/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.

<b>Signature:</b>

```typescript
export declare class OpenApiSpecBuilder extends BuilderBase<OpenAPIObject> 
```
<b>Extends:</b> [BuilderBase](./openapi-spec-builder.builderbase.md)<!-- -->&lt;OpenAPIObject&gt;

## Constructors

|  Constructor | Modifiers | Description |
|  --- | --- | --- |
|  [(constructor)()](./openapi-spec-builder.openapispecbuilder._constructor_.md) |  | Constructs a new instance of the <code>OpenApiSpecBuilder</code> class |

## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  [withComponents(spec)](./openapi-spec-builder.openapispecbuilder.withcomponents.md) |  | Define a new ComponentsObject. |
|  [withOperation(verb, path, spec)](./openapi-spec-builder.openapispecbuilder.withoperation.md) |  | Define a new OperationObject at the given path and verb (method). |
|  [withOperationReturningString(verb, path, operationName)](./openapi-spec-builder.openapispecbuilder.withoperationreturningstring.md) |  | Define a new operation that returns a string response. |


