UNPKG

koas-core

Version:

> [Koa][] + [OpenAPI Specification][] = Koas

20 lines (19 loc) 929 B
import { OpenAPIV3 } from 'openapi-types'; import { JSONRefResolver } from './jsonRefs'; /** * A matcher function for extracting URL parameters. * * @param url - The URL path to process. * @returns A mapping of parameter names to their extracted values. */ export declare type MatcherFunction = (url: string) => Record<string, string>; /** * Create a matcher function for an OpenAPI path template. * * @param pathTemplate - The OpenAPI path template for which to create a matcher. * @param resolveRef - A JSON reference resolver. * @param pathParameters - The OpenAPI path parameter objects used to determine how to process the * extracted parameters. * @returns a matcher function for extracting path parameters from a URL path. */ export declare function createMatcher(pathTemplate: string, resolveRef: JSONRefResolver, pathParameters?: (OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject)[]): MatcherFunction;