@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
45 lines (32 loc) • 2.52 kB
Markdown
---
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) > [@loopback/openapi-spec-builder](./openapi-spec-builder.md) > [OperationSpecBuilder](./openapi-spec-builder.operationspecbuilder.md)
## OperationSpecBuilder class
A builder for creating OperationObject specifications.
<b>Signature:</b>
```typescript
export declare class OperationSpecBuilder extends BuilderBase<OperationObject>
```
<b>Extends:</b> [BuilderBase](./openapi-spec-builder.builderbase.md)<!-- --><OperationObject>
## 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 |