| 33 | * @param route - Resolved Route |
| 34 | */ |
| 35 | export async function parseOperationArgs( |
| 36 | request: Request, |
| 37 | route: ResolvedRoute, |
| 38 | requestBodyParser: RequestBodyParser = new RequestBodyParser(), |
| 39 | options: ValidationOptions = DEFAULT_AJV_VALIDATION_OPTIONS, |
| 40 | ): Promise<OperationArgs> { |
| 41 | debug('Parsing operation arguments for route %s', route.describe()); |
| 42 | const operationSpec = route.spec; |
| 43 | const pathParams = route.pathParams; |
| 44 | const body = await requestBodyParser.loadRequestBodyIfNeeded( |
| 45 | operationSpec, |
| 46 | request, |
| 47 | ); |
| 48 | return buildOperationArguments( |
| 49 | operationSpec, |
| 50 | request, |
| 51 | pathParams, |
| 52 | body, |
| 53 | route.schemas, |
| 54 | options, |
| 55 | ); |
| 56 | } |
| 57 | |
| 58 | async function buildOperationArguments( |
| 59 | operationSpec: OperationObject, |