@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
97 lines (48 loc) • 1.45 kB
Markdown
---
lang: en
title: 'API docs: openapi-v3.operation'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/openapi-v3
permalink: /doc/en/lb4/apidocs.openapi-v3.operation.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/openapi-v3](./openapi-v3.md) > [operation](./openapi-v3.operation.md)
## operation() function
Expose a Controller method as a REST API operation.
**Signature:**
```typescript
export declare function operation(verb: string, path: string, spec?: OperationObject): MethodDecorator;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
verb
</td><td markdown="1">
string
</td><td markdown="1">
HTTP verb, e.g. `GET` or `POST`<!-- -->.
</td></tr>
<tr><td markdown="1">
path
</td><td markdown="1">
string
</td><td markdown="1">
The URL path of this operation, e.g. `/product/{id}`
</td></tr>
<tr><td markdown="1">
spec
</td><td markdown="1">
OperationObject
</td><td markdown="1">
_(Optional)_ The OpenAPI specification describing parameters and responses of this operation.
</td></tr>
</tbody></table>
**Returns:**
MethodDecorator