(paramType)
| 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( |
no test coverage detected