UNPKG

1.4 kBTypeScriptView Raw
1import { Context } from '@loopback/core';
2import { OperationObject, SchemasObject } from '@loopback/openapi-v3';
3import { OperationArgs, OperationRetval, PathParameterValues } from '../types';
4/**
5 * An entry in the routing table
6 */
7export interface RouteEntry {
8 /**
9 * http verb
10 */
11 readonly verb: string;
12 /**
13 * http path
14 */
15 readonly path: string;
16 /**
17 * OpenAPI operation spec
18 */
19 readonly spec: OperationObject;
20 /**
21 * Update bindings for the request context
22 * @param requestContext
23 */
24 updateBindings(requestContext: Context): void;
25 /**
26 * A handler to invoke the resolved controller method
27 * @param requestContext
28 * @param args
29 */
30 invokeHandler(requestContext: Context, args: OperationArgs): Promise<OperationRetval>;
31 describe(): string;
32}
33/**
34 * A route with path parameters resolved
35 */
36export interface ResolvedRoute extends RouteEntry {
37 readonly pathParams: PathParameterValues;
38 /**
39 * Server/application wide schemas shared by multiple routes,
40 * e.g. model schemas. This is a temporary workaround for
41 * missing support for $ref references, see
42 * https://github.com/loopbackio/loopback-next/issues/435
43 */
44 readonly schemas: SchemasObject;
45}
46export declare function createResolvedRoute(route: RouteEntry, pathParams: PathParameterValues): ResolvedRoute;