Coerce the http raw data to a JavaScript type data of a parameter according to its OpenAPI schema specification.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
string | undefined | any
|
The raw data get from http request |
||
| spec |
ParameterObject
|
Return the corresponding OpenAPI data type given an OpenAPI schema
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| type |
undefined | string
|
optional |
The type in an OpenAPI schema specification |
|
| format |
undefined | string
|
optional |
The format in an OpenAPI schema specification |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
string
|
A set of falsy values. A data in this set will be coerced to false.
The corresponding coerced boolean type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
string
|
The raw data get from http request |
A set of truthy values. A data in this set will be coerced to true.
The corresponding coerced boolean type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
string
|
The raw data get from http request |
Return false for invalid date
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
Date
|
Return true when a date follows the RFC3339 standard
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| date |
string
|
The date to verify |
Validator class provides a bunch of functions that perform validations on the request parameters and request body.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| ctx |
ValidationContext
|
constructorProperty exported public |
Validator class provides a bunch of functions that perform validations on the request parameters and request body. |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| ctx |
ValidationContext
|
Validator class provides a bunch of functions that perform validations on the request parameters and request body. |
Return true if the value is empty, return false otherwise.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
|
Check is a parameter required or not.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| opts |
ValidationOptions
|
optional |
|
The validation executed before type coercion. Like checking absence.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
string | any | undefined
|
A parameter's raw value from http request. |
||
| opts |
ValidationOptions
|
optional |
options |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| handleRequest |
anonymous
|
exported public |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| _rootContext |
Context
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| request |
Request
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| defs |
SchemasObject
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| spec |
ControllerSpec
|
|||
| controllerCtor |
ControllerClass<T>
|
|||
| controllerFactory |
ControllerFactory<T>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| route |
RouteEntry
|
RestServer-specific bindings
Request-specific bindings
Binding key for setting and injecting the http request context
Binding key for setting and injecting the http request
Binding key for setting and injecting the http response
Bindings for potential actions that could be used in a sequence
Binding key for setting and injecting a route finding function
Binding key for setting and injecting a controller route invoking function
Binding key for setting and injecting an error logging function
Binding key for setting and injecting a parameter parsing function
Binding key for setting and injecting a bad response writing function
Binding key for setting and injecting a response writing function
Binding key for setting and injecting an OpenAPI spec
Binding key for setting and injecting a wrapper function for setting values on a given context
Binding key for setting and injecting RestComponentConfig
Binding key for setting and injecting Reject action's error handling options.
See https://github.com/strongloop/strong-error-handler#options for
the list of available options. Please note that the flag log is not used
by @loopback/rest.
Binding key for setting and injecting a wrapper function for retrieving values from a given context
Internal binding key for http-handler
Binding key for setting and injecting the host name of RestServer
Binding key for HTTPS options
Binding key for setting and injecting the port number of RestServer
Binding key for setting and injecting the protocol of RestServer
Binding key for setting and injecting a Sequence
Binding key for setting and injecting the URL of RestServer
Parses the request to derive arguments to be passed in for the Application controller method
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| request |
Request
|
Incoming HTTP request |
||
| route |
ResolvedRoute
|
Resolved Route |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| context |
Context
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| context |
Context
|
|||
| handler |
HttpHandler
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| request |
Request
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| context |
Context
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| context |
Context
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| route |
RouteEntry
|
|||
| args |
OperationArgs
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| err |
Error
|
|||
| statusCode |
number
|
|||
| req |
Request
|
Provides the function for parsing args in requests at runtime.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| logError |
LogError
|
|||
| errorWriterOptions |
ErrorWriterOptions
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| __namedParameters |
anonymous
|
|||
| error |
Error
|
Provides the function that populates the response object with the results of the operation.
A per-request Context combining an IoC container with handler context (request, response, etc.).
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| request |
Request
|
constructorProperty exported public |
A per-request Context combining an IoC container with handler context (request, response, etc.). |
|
| response |
Response
|
constructorProperty exported public |
A per-request Context combining an IoC container with handler context (request, response, etc.). |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| request |
Request
|
A per-request Context combining an IoC container with handler context (request, response, etc.). |
||
| response |
Response
|
A per-request Context combining an IoC container with handler context (request, response, etc.). |
||
| parent |
Context
|
A per-request Context combining an IoC container with handler context (request, response, etc.). |
||
| name |
undefined | string
|
optional |
A per-request Context combining an IoC container with handler context (request, response, etc.). |
An invalid request body error contains a details property as the machine-readable error.
Each entry in error.details contains 4 attributes: path, code, info and message.
ValidationErrorDetails defines the type of each entry, which is an object.
The type of error.details is ValidationErrorDetails[].
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
T
|
|||
| name |
string
|
|||
| extraProperties |
Props
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| location |
string
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
An implementation of the Application class that automatically provides an instance of a REST server. This application class is intended to be a single-server implementation. Any attempt to bind additional servers will throw an error.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| config |
ApplicationConfig
|
{} |
An implementation of the Application class that automatically provides an instance of a REST server. This application class is intended to be a single-server implementation. Any attempt to bind additional servers will throw an error. |
Handle incoming HTTP(S) request by invoking the corresponding Controller method via the configured Sequence.
The main REST server instance providing REST API for this application.
Set the OpenAPI specification that defines the REST API schema for this application. All routes, parameter definitions and return types will be defined in this way.
Note that this will override any routes defined via decorators at the controller level (this function takes precedent).
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| spec |
OpenApiSpec
|
The OpenAPI specification, as an object. |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| handlerFn |
SequenceFunction
|
An implementation of the Application class that automatically provides an instance of a REST server. This application class is intended to be a single-server implementation. Any attempt to bind additional servers will throw an error. |
Register a new Controller-based route.
class MyController {
greet(name: string) {
return `hello ${name}`;
}
}
app.route('get', '/greet', operationSpec, MyController, 'greet');
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| verb |
string
|
HTTP verb of the endpoint |
||
| path |
string
|
URL path of the endpoint |
||
| spec |
OperationObject
|
The OpenAPI spec describing the endpoint (operation) |
||
| controllerCtor |
ControllerClass<T>
|
Controller constructor |
||
| controllerFactory |
ControllerFactory<T>
|
A factory function to create controller instance |
||
| methodName |
string
|
The name of the controller method |
Register a new route.
function greet(name: string) {
return `hello ${name}`;
}
const route = new Route('get', '/', operationSpec, greet);
app.route(route);
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| route |
RouteEntry
|
The route to add. |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| sequence |
Constructor<SequenceHandler>
|
An implementation of the Application class that automatically provides an instance of a REST server. This application class is intended to be a single-server implementation. Any attempt to bind additional servers will throw an error. |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| server |
Constructor<Server>
|
An implementation of the Application class that automatically provides an instance of a REST server. This application class is intended to be a single-server implementation. Any attempt to bind additional servers will throw an error. |
||
| name |
undefined | string
|
optional |
An implementation of the Application class that automatically provides an instance of a REST server. This application class is intended to be a single-server implementation. Any attempt to bind additional servers will throw an error. |
Mount static assets to the REST server. See https://expressjs.com/en/4x/api.html#express.static
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| path |
PathParams
|
The path(s) to serve the asset.
See examples at https://expressjs.com/en/4x/api.html#path-examples
To avoid performance penalty, |
||
| rootDir |
string
|
The root directory from which to serve static assets |
||
| options |
ServeStaticOptions
|
optional |
Options for serve-static |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| app |
Application
|
|||
| config |
RestComponentConfig
|
optional |
A REST API server for use with Loopback. Add this server to your application by importing the RestComponent.
const app = new MyApplication();
app.component(RestComponent);
To add additional instances of RestServer to your application, use the
.server function:
app.server(RestServer, 'nameOfYourServer');
By default, one instance of RestServer will be created when the RestComponent
is bootstrapped. This instance can be retrieved with
app.getServer(RestServer), or by calling app.get('servers.RestServer')
Note that retrieving other instances of RestServer must be done using the
server's name:
const server = await app.getServer('foo')
// OR
const server = await app.get('servers.foo');
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| config |
RestServerConfig
|
exported public |
A REST API server for use with Loopback. Add this server to your application by importing the RestComponent.
To add additional instances of RestServer to your application, use the
By default, one instance of RestServer will be created when the RestComponent
is bootstrapped. This instance can be retrieved with
|
|
| requestHandler |
HttpRequestListener
|
exported public |
Handle incoming HTTP(S) request by invoking the corresponding Controller method via the configured Sequence. |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| app |
Application
|
The application instance (injected via CoreBindings.APPLICATION_INSTANCE). |
||
| config |
RestServerConfig
|
{} |
The configuration options (injected via RestBindings.CONFIG). |
Set the OpenAPI specification that defines the REST API schema for this server. All routes, parameter definitions and return types will be defined in this way.
Note that this will override any routes defined via decorators at the controller level (this function takes precedent).
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| spec |
OpenApiSpec
|
The OpenAPI specification, as an object. |
Register a controller class with this server.
The newly created binding, you can use the reference to further modify the binding, e.g. lock the value to prevent further modifications.
class MyController {
}
app.controller(MyController).lock();
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| controllerCtor |
ControllerClass<ControllerInstance>
|
The controller class (constructor function). |
Get the OpenAPI specification describing the REST API provided by this application.
This method merges operations (HTTP endpoints) from the following sources:
app.api(spec)app.controller(MyController)app.route(route)app.route('get', '/greet', operationSpec, MyController, 'greet')Configure a custom sequence function for handling incoming requests.
app.handler(({request, response}, sequence) => {
sequence.send(response, 'hello world');
});
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| handlerFn |
SequenceFunction
|
The handler to invoke for each incoming request. |
Register a new Controller-based route.
class MyController {
greet(name: string) {
return `hello ${name}`;
}
}
app.route('get', '/greet', operationSpec, MyController, 'greet');
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| verb |
string
|
HTTP verb of the endpoint |
||
| path |
string
|
URL path of the endpoint |
||
| spec |
OperationObject
|
The OpenAPI spec describing the endpoint (operation) |
||
| controllerCtor |
ControllerClass<I>
|
Controller constructor |
||
| controllerFactory |
ControllerFactory<I>
|
A factory function to create controller instance |
||
| methodName |
string
|
The name of the controller method |
Register a new route.
function greet(name: string) {
return `hello ${name}`;
}
const route = new Route('get', '/', operationSpec, greet);
app.route(route);
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| route |
RouteEntry
|
The route to add. |
Configure a custom sequence class for handling incoming requests.
class MySequence implements SequenceHandler {
constructor(
@inject('send) public send: Send)) {
}
public async handle({response}: RequestContext) {
send(response, 'hello world');
}
}
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
Constructor<SequenceHandler>
|
The sequence to invoke for each incoming request. |
Start this REST API's HTTP/HTTPS server.
Mount static assets to the REST server. See https://expressjs.com/en/4x/api.html#express.static
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| path |
PathParams
|
The path(s) to serve the asset.
See examples at https://expressjs.com/en/4x/api.html#path-examples
To avoid performance penalty, |
||
| rootDir |
string
|
The root directory from which to serve static assets |
||
| options |
ServeStaticOptions
|
optional |
Options for serve-static |
Stop this REST API's HTTP/HTTPS server.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| httpUrl |
undefined | string
|
exported optional |
URL for the API explorer served over |
|
| url |
undefined | string
|
exported optional |
URL for the hosted API explorer UI default to https://loopback.io/api-explorer |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| requestHandler |
HttpRequestListener
|
exported |
The form of OpenAPI specs to be served
Options to customize how OpenAPI specs are served
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| endpointMapping |
undefined | anonymous
|
exported optional |
Mapping of urls to spec forms, by default:
|
|
| servers |
ServerObject[]
|
exported optional |
Configure servers for OpenAPI spec |
|
| setServersFromRequest |
undefined | false | true
|
exported optional |
A flag to force |
Options for RestServer configuration
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| apiExplorer |
ApiExplorerOptions
|
exported optional |
Options for RestServer configuration |
|
| cors |
cors.CorsOptions
|
exported optional |
Options for RestServer configuration |
|
| openApiSpec |
OpenApiSpecOptions
|
exported optional |
Options for RestServer configuration |
|
| sequence |
Constructor<SequenceHandler>
|
exported optional |
Options for RestServer configuration |
| Name | Type | Description |
|---|---|---|
| req |
ServerRequest
|
|
| res |
ServerResponse
|
Base implementation of RouteEntry
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| path |
string
|
constructorProperty exported public |
http request path pattern |
|
| spec |
OperationObject
|
constructorProperty exported public |
OpenAPI operation spec |
|
| verb |
string
|
exported public |
Base implementation of RouteEntry |
Construct a new route
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| verb |
string
|
http verb |
||
| path |
string
|
http request path pattern |
||
| spec |
OperationObject
|
OpenAPI operation spec |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| requestContext |
Context
|
Base implementation of RouteEntry |
||
| args |
OperationArgs
|
Base implementation of RouteEntry |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| request |
Request
|
Base implementation of RouteEntry |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| requestContext |
Context
|
Base implementation of RouteEntry |
A route backed by a controller
Construct a controller based route
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| verb |
string
|
http verb |
||
| path |
string
|
http request path |
||
| spec |
OperationObject
|
OpenAPI operation spec |
||
| controllerCtor |
ControllerClass<T>
|
Controller class |
||
| controllerFactory |
ControllerFactory<T>
|
optional |
A factory function to create a controller instance |
|
| methodName |
undefined | string
|
optional |
Controller method name, default to |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| requestContext |
Context
|
A route backed by a controller |
||
| args |
OperationArgs
|
A route backed by a controller |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| requestContext |
Context
|
A route backed by a controller |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| spec |
OperationObject
|
constructorProperty exported public |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| verb |
string
|
|||
| path |
string
|
|||
| spec |
OperationObject
|
|||
| _handler |
Function
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| requestContext |
Context
|
|||
| args |
OperationArgs
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| requestContext |
Context
|
Routing table
Map a request to a route
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| request |
Request
|
|
Register a controller as the route
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| spec |
ControllerSpec
|
|
||
| controllerCtor |
ControllerClass<T>
|
|
||
| controllerFactory |
ControllerFactory<T>
|
optional |
|
Register a route
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| route |
RouteEntry
|
A route entry |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| basePath |
string
|
Routing table |
||
| path |
string
|
Routing table |
A route with path parameters resolved
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| pathParams |
PathParameterValues
|
exported |
A route with path parameters resolved |
|
| schemas |
SchemasObject
|
exported |
Server/application wide schemas shared by multiple routes, e.g. model schemas. This is a temporary workaround for missing support for $ref references, see https://github.com/strongloop/loopback-next/issues/435 |
An entry in the routing table
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| path |
string
|
exported |
http path |
|
| spec |
OperationObject
|
exported |
OpenAPI operation spec |
|
| verb |
string
|
exported |
http verb |
A handler to invoke the resolved controller method
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| requestContext |
Context
|
|
||
| args |
OperationArgs
|
|
Map an http request to a route
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| request |
Request
|
|
Update bindings for the request context
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| requestContext |
Context
|
|
A factory function to create controller instances synchronously or asynchronously
| Name | Type | Description |
|---|---|---|
| ctx |
Context
|
Create a controller factory function for a given binding key
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Binding key |
Create a controller factory function for a given class
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| controllerCtor |
ControllerClass<T>
|
Controller class |
Create a controller factory function for a given instance
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| controllerInst |
T
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| route |
RouteEntry
|
|||
| pathParams |
PathParameterValues
|
The default implementation of SequenceHandler.
This class implements default Sequence for the LoopBack framework. Default sequence is used if user hasn't defined their own Sequence for their application.
Sequence constructor() and run() methods are invoked from [[http-handler]] when the API request comes in. User defines APIs in their Application Controller class.
User can bind their own Sequence to app as shown below
app.bind(CoreBindings.SEQUENCE).toClass(MySequence);
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| reject |
Reject
|
constructorProperty exported public |
The action to take if the invoke returns a rejected promise result (injected via SequenceActions.REJECT). |
|
| send |
Send
|
constructorProperty exported public |
The action to merge the invoke result with the response (injected via SequenceActions.SEND) |
Constructor: Injects findRoute, invokeMethod & logError methods as promises.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| findRoute |
FindRoute
|
Finds the appropriate controller method, spec and args for invocation (injected via SequenceActions.FIND_ROUTE). |
||
| parseParams |
ParseParams
|
The parameter parsing function (injected via SequenceActions.PARSE_PARAMS). |
||
| invoke |
InvokeMethod
|
Invokes the method specified by the route (injected via SequenceActions.INVOKE_METHOD). |
||
| send |
Send
|
The action to merge the invoke result with the response (injected via SequenceActions.SEND) |
||
| reject |
Reject
|
The action to take if the invoke returns a rejected promise result (injected via SequenceActions.REJECT). |
Runs the default sequence. Given a handler context (request and response), running the sequence will produce a response or an error.
Default sequence executes these steps
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| context |
RequestContext
|
The request context: HTTP request and response objects, per-request IoC container and more. |
A sequence handler is a class implementing sequence of actions required to handle an incoming request.
Handle the request by running the configured sequence of actions.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| context |
RequestContext
|
The request context: HTTP request and response objects, per-request IoC container and more. |
A sequence function is a function implementing a custom sequence of actions to handle an incoming request.
| Name | Type | Description |
|---|---|---|
| context |
RequestContext
|
|
| sequence |
DefaultSequence
|
An object holding HTTP request, response and other data needed to handle an incoming HTTP request.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| request |
Request
|
exported |
An object holding HTTP request, response and other data needed to handle an incoming HTTP request. |
|
| response |
Response
|
exported |
An object holding HTTP request, response and other data needed to handle an incoming HTTP request. |
| Name | Type | Description |
|---|---|---|
| key |
string
|
Find a route matching the incoming request. Throw an error when no route was found.
| Name | Type | Description |
|---|---|---|
| request |
Request
|
| Name | Type | Description |
|---|---|---|
| key |
string
|
Invokes a method defined in the Application Controller
Returns:OperationRetval Result from method invocation
| Name | Type | Description |
|---|---|---|
| route |
RouteEntry
|
|
| args |
OperationArgs
|
Operation arguments for the method |
Log information about a failed request.
Returns:| Name | Type | Description |
|---|---|---|
| err |
Error
|
The error reported by request handling code. |
| statusCode |
number
|
Status code of the HTTP response |
| request |
Request
|
The request that failed. |
| Name | Type | Description |
|---|---|---|
| request |
Request
|
|
| route |
ResolvedRoute
|
| Name | Type | Description |
|---|---|---|
| key |
string
|
Reject the request with an error.
Returns:| Name | Type | Description |
|---|---|---|
| handlerContext |
HandlerContext
|
The context object holding HTTP request, response and other data needed to handle an incoming HTTP request. |
| err |
Error
|
The error. |
Send the operation response back to the client.
Returns:| Name | Type | Description |
|---|---|---|
| response |
Response
|
The response the response to send to. |
| result |
OperationRetval
|
The operation result to send. |
Check whether the request body is valid according to the provided OpenAPI schema.
The JSON schema is generated from the OpenAPI schema which is typically defined
by @requestBody().
The validation leverages AJS shema validator.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| body |
any
|
The body data from an HTTP request. |
||
| requestBodySpec |
RequestBodyObject | undefined
|
The OpenAPI requestBody specification defined in |
||
| globalSchemas |
SchemasObject
|
optional |
The referenced schemas generated from |
Writes the result from Application controller method into the HTTP response
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| response |
Response
|
HTTP Response |
||
| result |
OperationRetval
|
Result from the API to write into HTTP Response |