MCPcopy Index your code
hub / github.com/rapi-doc/RapiDoc / inputParametersTemplate

Method inputParametersTemplate

src/components/api-request.js:328–560  ·  view source on GitHub ↗
(paramType)

Source from the content-addressed store, hash-verified

326 }
327
328 inputParametersTemplate(paramType) {
329 const filteredParams = this.parameters ? this.parameters.filter((param) => param.in === paramType) : [];
330 if (filteredParams.length === 0) {
331 return '';
332 }
333 let title = '';
334 if (paramType === 'path') {
335 title = 'PATH PARAMETERS';
336 } else if (paramType === 'query') {
337 title = 'QUERY-STRING PARAMETERS';
338 } else if (paramType === 'header') {
339 title = 'REQUEST HEADERS';
340 } else if (paramType === 'cookie') {
341 title = 'COOKIES';
342 }
343
344 const tableRows = [];
345 for (const param of filteredParams) {
346 const [declaredParamSchema, serializeStyle, mimeTypeElem] = getSchemaFromParam(param);
347 if (!declaredParamSchema) {
348 continue;
349 }
350 const paramSchema = getTypeInfo(declaredParamSchema);
351 if (!paramSchema) {
352 continue; // eslint-disable-line no-continue
353 }
354 const schemaAsObj = schemaInObjectNotation(declaredParamSchema, {});
355 // let exampleVal = '';
356 // let exampleList = [];
357 let paramStyle = 'form';
358 let paramExplode = true;
359 let paramAllowReserved = false;
360 if (paramType === 'query' || paramType === 'header' || paramType === 'path') {
361 if (param.style && 'form spaceDelimited pipeDelimited'.includes(param.style)) {
362 paramStyle = param.style;
363 } else if (serializeStyle) {
364 paramStyle = serializeStyle;
365 }
366 if (typeof param.explode === 'boolean') {
367 paramExplode = param.explode;
368 }
369 if (typeof param.allowReserved === 'boolean') {
370 paramAllowReserved = param.allowReserved;
371 }
372 }
373 // openapi 3.1.0 spec based examples (which must be Object(string : { value:any, summary?: string, description?: string})
374 const example = normalizeExamples(
375 (standardizeExample(param.examples)
376 || standardizeExample(param.example)
377 || standardizeExample(mimeTypeElem?.example)
378 || standardizeExample(mimeTypeElem?.examples)
379 || standardizeExample(paramSchema.examples)
380 || standardizeExample(paramSchema.example)
381 ),
382 paramSchema.type,
383 );
384 if (!example.exampleVal && paramSchema.type === 'object') {
385 example.exampleVal = generateExample(

Callers 1

renderMethod · 0.95

Calls 14

getRequestPanelMethod · 0.95
liveCURLSyntaxUpdateMethod · 0.95
getSchemaFromParamFunction · 0.90
getTypeInfoFunction · 0.90
schemaInObjectNotationFunction · 0.90
normalizeExamplesFunction · 0.90
standardizeExampleFunction · 0.90
generateExampleFunction · 0.90
htmlFunction · 0.85
markedFunction · 0.50
filterMethod · 0.45
includesMethod · 0.45

Tested by

no test coverage detected