---
lang: en
title: 'API docs: openapi-spec-builder.operationspecbuilder'
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.operationspecbuilder.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; [OperationSpecBuilder](./openapi-spec-builder.operationspecbuilder.md)

## OperationSpecBuilder class

A builder for creating OperationObject specifications.

**Signature:**

```typescript
export declare class OperationSpecBuilder extends BuilderBase<OperationObject> 
```
**Extends:** [BuilderBase](./openapi-spec-builder.builderbase.md)<!-- -->&lt;OperationObject&gt;

## Constructors

|  Constructor | Modifiers | Description |
|  --- | --- | --- |
|  [(constructor)()](./openapi-spec-builder.operationspecbuilder._constructor_.md) |  | Constructs a new instance of the <code>OperationSpecBuilder</code> class |

## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  [withControllerName(name)](./openapi-spec-builder.operationspecbuilder.withcontrollername.md) |  | Define the controller name (controller name). |
|  [withOperationId(operationId)](./openapi-spec-builder.operationspecbuilder.withoperationid.md) |  | Define the operationId |
|  [withOperationName(name)](./openapi-spec-builder.operationspecbuilder.withoperationname.md) |  | Define the operation name (controller method name). |
|  [withParameter(parameterSpecs)](./openapi-spec-builder.operationspecbuilder.withparameter.md) |  | Describe one more parameters accepted by the operation. Note that parameters are positional in OpenAPI Spec, therefore the first call of <code>withParameter</code> defines the first parameter, the second call defines the second parameter, etc. |
|  [withRequestBody(requestBodySpec)](./openapi-spec-builder.operationspecbuilder.withrequestbody.md) |  |  |
|  [withResponse(status, responseSpec)](./openapi-spec-builder.operationspecbuilder.withresponse.md) |  | Describe a response for a given HTTP status code. |
|  [withStringResponse(status)](./openapi-spec-builder.operationspecbuilder.withstringresponse.md) |  |  |
|  [withTags(tags)](./openapi-spec-builder.operationspecbuilder.withtags.md) |  | Describe tags associated with the operation |


