MCPcopy Create free account
hub / github.com/axe-api/axe-api / toRequestParameters

Function toRequestParameters

packages/axe-api/src/Builders/SwaggerBuilder.ts:337–510  ·  view source on GitHub ↗
(
  endpoint: IRouteDocumentation,
  modelService: IModelService,
)

Source from the content-addressed store, hash-verified

335};
336
337const toRequestParameters = (
338 endpoint: IRouteDocumentation,
339 modelService: IModelService,
340) => {
341 const parameters: any = [
342 {
343 in: "header",
344 name: "Accept-Language",
345 schema: {
346 type: "string",
347 example: "en;q=0.8, de;q=0.7, *;q=0.5",
348 },
349 required: false,
350 },
351 ];
352
353 if (endpoint.url.includes(":")) {
354 const sections = endpoint.url
355 .split("/")
356 .filter((item) => item.includes(":"))
357 .map((item) => item.replace(":", ""));
358
359 for (const section of sections) {
360 parameters.push({
361 in: "path",
362 name: section,
363 required: true,
364 });
365 }
366 }
367
368 if (endpoint.handler === HandlerTypes.PAGINATE) {
369 parameters.push(
370 ...[
371 {
372 name: "page",
373 in: "query",
374 description: "The page number to list",
375 required: false,
376 schema: {
377 type: "integer",
378 default: 1,
379 },
380 },
381 {
382 name: "per_page",
383 in: "query",
384 description: "Number of records to list on a page",
385 required: false,
386 schema: {
387 type: "integer",
388 default: 10,
389 },
390 },
391 {
392 name: "sort",
393 in: "query",
394 description: "The field to sort the data (ASC: id, DESC: -id)",

Callers 1

generateDocumentationFunction · 0.85

Calls 2

isQueryFeatureEnabledFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected