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 (/).

components ComponentsObject

OpenAPI components.schemas generated from model metadata

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

Function: getControllerSpec

getControllerSpec(constructor: Function) : ControllerSpec

Get the controller spec for the given class

Arguments
Name Type Description
constructor Function

Controller class

Function: api

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

Function: del

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.

Function: get

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.

Function: operation

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.

Function: patch

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.

Function: post

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.

Function: put

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.

Function: param.array

param.array(name: string, source: ParameterLocation, itemSpec: undefined) : (Anonymous function)

Define a parameter of array type.

Arguments
Name Type Description
name string

Parameter name

source ParameterLocation

Source of the parameter value

itemSpec

Item type for the array or the full item object

Object literal: param.header

Variables
Name Type Description
binary (Anonymous function)

Define a parameter of "binary" type that's read from a request header. Usage: @param.header.binary('paramName')

boolean (Anonymous function)

Define a parameter of "boolean" type that's read from a request header. Usage: @param.header.boolean('paramName')

byte (Anonymous function)

Define a parameter of "byte" type that's read from a request header. Usage: @param.header.byte('paramName')

date (Anonymous function)

Define a parameter of "date" type that's read from a request header. Usage: @param.header.date('paramName')

dateTime (Anonymous function)

Define a parameter of "dateTime" type that's read from a request header. Usage: @param.header.dateTime('paramName')

double (Anonymous function)

Define a parameter of "double" type that's read from a request header. Usage: @param.header.double('paramName')

float (Anonymous function)

Define a parameter of "float" type that's read from a request header. Usage: @param.header.float('paramName')

integer (Anonymous function)

Define a parameter of "integer" type that's read from a request header. Usage: @param.header.integer('paramName')

long (Anonymous function)

Define a parameter of "long" type that's read from a request header. Usage: @param.header.long('paramName')

number (Anonymous function)

Define a parameter of "number" type that's read from a request header. Usage: @param.header.number('paramName')

password (Anonymous function)

Define a parameter of "password" type that's read from a request header. Usage: @param.header.password('paramName')

string (Anonymous function)

Define a parameter of "string" type that's read from a request header. Usage: @param.header.string('paramName')

Object literal: param.path

Variables
Name Type Description
binary (Anonymous function)

Define a parameter of "binary" type that's read from request path. Usage: @param.path.binary('paramName')

boolean (Anonymous function)

Define a parameter of "boolean" type that's read from request path. Usage: @param.path.boolean('paramName')

byte (Anonymous function)

Define a parameter of "byte" type that's read from request path. Usage: @param.path.byte('paramName')

date (Anonymous function)

Define a parameter of "date" type that's read from request path. Usage: @param.path.date('paramName')

dateTime (Anonymous function)

Define a parameter of "dateTime" type that's read from request path. Usage: @param.path.dateTime('paramName')

double (Anonymous function)

Define a parameter of "double" type that's read from request path. Usage: @param.path.double('paramName')

float (Anonymous function)

Define a parameter of "float" type that's read from request path. Usage: @param.path.float('paramName')

integer (Anonymous function)

Define a parameter of "integer" type that's read from request path. Usage: @param.path.integer('paramName')

long (Anonymous function)

Define a parameter of "long" type that's read from request path. Usage: @param.path.long('paramName')

number (Anonymous function)

Define a parameter of "number" type that's read from request path. Usage: @param.path.number('paramName')

password (Anonymous function)

Define a parameter of "password" type that's read from request path. Usage: @param.path.password('paramName')

string (Anonymous function)

Define a parameter of "string" type that's read from request path. Usage: @param.path.string('paramName')

Object literal: param.query

Variables
Name Type Description
binary (Anonymous function)

Define a parameter of "binary" type that's read from the query string. Usage: @param.query.binary('paramName')

boolean (Anonymous function)

Define a parameter of "boolean" type that's read from the query string. Usage: @param.query.boolean('paramName')

byte (Anonymous function)

Define a parameter of "byte" type that's read from the query string. Usage: @param.query.byte('paramName')

date (Anonymous function)

Define a parameter of "date" type that's read from the query string. Usage: @param.query.date('paramName')

dateTime (Anonymous function)

Define a parameter of "dateTime" type that's read from the query string. Usage: @param.query.dateTime('paramName')

double (Anonymous function)

Define a parameter of "double" type that's read from the query string. Usage: @param.query.double('paramName')

float (Anonymous function)

Define a parameter of "float" type that's read from the query string. Usage: @param.query.float('paramName')

integer (Anonymous function)

Define a parameter of "integer" type that's read from the query string. Usage: @param.query.integer('paramName')

long (Anonymous function)

Define a parameter of "long" type that's read from the query string. Usage: @param.query.long('paramName')

number (Anonymous function)

Define a parameter of "number" type that's read from the query string. Usage: @param.query.number('paramName')

password (Anonymous function)

Define a parameter of "password" type that's read from the query string. Usage: @param.query.password('paramName')

string (Anonymous function)

Define a parameter of "integer" type that's read from the query string. Usage: @param.query.string('paramName')

Interface: paramShortcutOptions

Properties
Name Type Description
format
type string

Object literal: builtinTypes

The type and format inferred by a common name of OpenAPI 3.0.0 data type reference link: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types

Function: requestBody.array

requestBody.array(itemSpec: undefined, properties: undefined) : (Anonymous function)

Define a requestBody of array type.

Arguments
Name Type Description
itemSpec

the full item object

properties

The requestBody properties other than content

Interface: TypeAndFormat

Properties
Name Type Description
format

type

Function: getSchemaForParam

getSchemaForParam(type: Function, schema: SchemaObject) : SchemaObject

Generate the type and format property in a Schema Object according to a parameter's type. type and format will be preserved if provided in schema

Arguments
Name Type Description
type Function

The JavaScript type of a parameter

schema SchemaObject

The schema object provided in an parameter object

Function: getSchemaForRequestBody

getSchemaForRequestBody(type: Function) : SchemaObject

Get OpenAPI Schema for a JavaScript type for a body parameter

Arguments
Name Type Description
type Function

The JavaScript type of an argument deccorated by @requestBody

Function: jsonToSchemaObject

jsonToSchemaObject(jsonDef: JsonDefinition) : SchemaObject

Arguments
Name Type Description
jsonDef JsonDefinition