Class: restmethodparameterdecoratorfactory = new RestMethodParameterDecoratorFactory()

Interface: ControllerSpec

Properties
Name Type Description
basePath

The base path on which the Controller API is served. If it is not included, the API is served directly under the host. The value MUST start with a leading slash (/).

definitions DefinitionsObject

JSON Schema definitions of models used by the controller

paths PathsObject

The available paths and operations for the API.

Interface: RestEndpoint

Data structure for REST related metadata

Properties
Name Type Description
path string

Data structure for REST related metadata

spec OperationObject

Data structure for REST related metadata

verb string

Data structure for REST related metadata

api(spec: ControllerSpec) :

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 {
  // ...
}

Arguments
Name Type Description
spec ControllerSpec

OpenAPI specification describing the endpoints handled by this controller

del(path: string, spec: OperationObject) :

Expose a Controller method as a REST API operation mapped to DELETE request method.

Arguments
Name Type Description
path string

The URL path of this operation, e.g. /product/{id}

spec OperationObject

The OpenAPI specification describing parameters and responses of this operation.

get(path: string, spec: OperationObject) :

Expose a Controller method as a REST API operation mapped to GET request method.

Arguments
Name Type Description
path string

The URL path of this operation, e.g. /product/{id}

spec OperationObject

The OpenAPI specification describing parameters and responses of this operation.

getControllerSpec(constructor: Function) : ControllerSpec

Get the controller spec for the given class

Arguments
Name Type Description
constructor Function

Controller class

jsonToSchemaObject(jsonDef: JsonDefinition) : SchemaObject

Arguments
Name Type Description
jsonDef JsonDefinition

operation(verb: string, path: string, spec: OperationObject) :

Expose a Controller method as a REST API operation.

Arguments
Name Type Description
verb string

HTTP verb, e.g. GET or POST.

path string

The URL path of this operation, e.g. /product/{id}

spec OperationObject

The OpenAPI specification describing parameters and responses of this operation.

patch(path: string, spec: OperationObject) :

Expose a Controller method as a REST API operation mapped to PATCH request method.

Arguments
Name Type Description
path string

The URL path of this operation, e.g. /product/{id}

spec OperationObject

The OpenAPI specification describing parameters and responses of this operation.

post(path: string, spec: OperationObject) :

Expose a Controller method as a REST API operation mapped to POST request method.

Arguments
Name Type Description
path string

The URL path of this operation, e.g. /product/{id}

spec OperationObject

The OpenAPI specification describing parameters and responses of this operation.

put(path: string, spec: OperationObject) :

Expose a Controller method as a REST API operation mapped to PUT request method.

Arguments
Name Type Description
path string

The URL path of this operation, e.g. /product/{id}

spec OperationObject

The OpenAPI specification describing parameters and responses of this operation.