@loopback/docs
Version:
Documentation for LoopBack 4
43 lines (30 loc) • 2.29 kB
Markdown
---
lang: en
title: 'API docs: openapi-spec-builder.operationspecbuilder'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
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>
```
## 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 |