@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
188 lines (87 loc) • 3.46 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.
**Signature:**
```typescript
export declare class OperationSpecBuilder extends BuilderBase<OperationObject>
```
**Extends:** [BuilderBase](./openapi-spec-builder.builderbase.md)<!-- --><OperationObject>
## Constructors
<table><thead><tr><th>
Constructor
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
[(constructor)()](./openapi-spec-builder.operationspecbuilder._constructor_.md)
</td><td markdown="1">
</td><td markdown="1">
Constructs a new instance of the `OperationSpecBuilder` class
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
[withControllerName(name)](./openapi-spec-builder.operationspecbuilder.withcontrollername.md)
</td><td markdown="1">
</td><td markdown="1">
Define the controller name (controller name).
</td></tr>
<tr><td markdown="1">
[withOperationId(operationId)](./openapi-spec-builder.operationspecbuilder.withoperationid.md)
</td><td markdown="1">
</td><td markdown="1">
Define the operationId
</td></tr>
<tr><td markdown="1">
[withOperationName(name)](./openapi-spec-builder.operationspecbuilder.withoperationname.md)
</td><td markdown="1">
</td><td markdown="1">
Define the operation name (controller method name).
</td></tr>
<tr><td markdown="1">
[withParameter(parameterSpecs)](./openapi-spec-builder.operationspecbuilder.withparameter.md)
</td><td markdown="1">
</td><td markdown="1">
Describe one more parameters accepted by the operation. Note that parameters are positional in OpenAPI Spec, therefore the first call of `withParameter` defines the first parameter, the second call defines the second parameter, etc.
</td></tr>
<tr><td markdown="1">
[withRequestBody(requestBodySpec)](./openapi-spec-builder.operationspecbuilder.withrequestbody.md)
</td><td markdown="1">
</td><td markdown="1">
</td></tr>
<tr><td markdown="1">
[withResponse(status, responseSpec)](./openapi-spec-builder.operationspecbuilder.withresponse.md)
</td><td markdown="1">
</td><td markdown="1">
Describe a response for a given HTTP status code.
</td></tr>
<tr><td markdown="1">
[withStringResponse(status)](./openapi-spec-builder.operationspecbuilder.withstringresponse.md)
</td><td markdown="1">
</td><td markdown="1">
</td></tr>
<tr><td markdown="1">
[withTags(tags)](./openapi-spec-builder.operationspecbuilder.withtags.md)
</td><td markdown="1">
</td><td markdown="1">
Describe tags associated with the operation
</td></tr>
</tbody></table>