@loopback/docs
Version:
Documentation for LoopBack 4
36 lines (23 loc) • 1.03 kB
Markdown
---
lang: en
title: 'API docs: openapi-v3.operation'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
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.
<b>Signature:</b>
```typescript
export declare function operation(verb: string, path: string, spec?: OperationObject): MethodDecorator;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| verb | <code>string</code> | HTTP verb, e.g. <code>GET</code> or <code>POST</code>. |
| path | <code>string</code> | The URL path of this operation, e.g. <code>/product/{id}</code> |
| spec | <code>OperationObject</code> | The OpenAPI specification describing parameters and responses of this operation. |
<b>Returns:</b>
`MethodDecorator`