@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
40 lines (27 loc) • 1.7 kB
Markdown
---
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) > [@loopback/openapi-spec-builder](./openapi-spec-builder.md) > [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)<!-- --><OpenAPIObject>
## 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. |