Page Contents

Home > @loopback/openapi-spec-builder > OperationSpecBuilder

OperationSpecBuilder class

A builder for creating OperationObject specifications.

Signature:

export declare class OperationSpecBuilder extends BuilderBase<OperationObject> 

Extends: BuilderBase<OperationObject>

Constructors

Constructor Modifiers Description
[(constructor)()](/doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder._constructor_.html) Constructs a new instance of the `OperationSpecBuilder` class

Methods

Method Modifiers Description
[withControllerName(name)](/doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder.withcontrollername.html) Define the controller name (controller name).
[withOperationId(operationId)](/doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder.withoperationid.html) Define the operationId
[withOperationName(name)](/doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder.withoperationname.html) Define the operation name (controller method name).
[withParameter(parameterSpecs)](/doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder.withparameter.html) 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.
[withRequestBody(requestBodySpec)](/doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder.withrequestbody.html)
[withResponse(status, responseSpec)](/doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder.withresponse.html) Describe a response for a given HTTP status code.
[withStringResponse(status)](/doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder.withstringresponse.html)
[withTags(tags)](/doc/en/lb4/apidocs.openapi-spec-builder.operationspecbuilder.withtags.html) Describe tags associated with the operation