Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions packages/openapi-v2/src/api-decorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright IBM Corp. 2018. All Rights Reserved.
// Node module: @loopback/openapi-v2
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

import {ControllerSpec} from './controller-spec';
import {ClassDecoratorFactory} from '@loopback/context';
import {OAI2Keys} from './keys';

/**
* Decorate the given Controller constructor with metadata describing
* the HTTP/REST API the Controller implements/provides.
*
* `@api` can be applied to controller classes. For example,
* ```
* @api({basePath: '/my'})
* class MyController {
* // ...
* }
* ```
*
* @param spec OpenAPI specification describing the endpoints
* handled by this controller
*
* @decorator
*/
export function api(spec: ControllerSpec) {
return ClassDecoratorFactory.createDecorator<ControllerSpec>(
OAI2Keys.CLASS_KEY,
spec,
);
}
Loading