( container: Record<string, unknown>, from: string, to: string, )
| 286 | } |
| 287 | |
| 288 | function replacePathParamName( |
| 289 | container: Record<string, unknown>, |
| 290 | from: string, |
| 291 | to: string, |
| 292 | ): void { |
| 293 | const params = container['parameters']; |
| 294 | if (Array.isArray(params)) { |
| 295 | for (const param of params) { |
| 296 | const record = asRecord(param); |
| 297 | if (record?.['in'] === 'path' && record['name'] === from) { |
| 298 | record['name'] = to; |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | for (const method of ['get', 'post', 'put', 'patch', 'delete']) { |
| 304 | const operation = asRecord(container[method]); |
| 305 | if (operation !== undefined) { |
| 306 | replacePathParamName(operation, from, to); |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | function cloneRecord(value: Record<string, unknown>): Record<string, unknown> { |
| 312 | return structuredClone(value); |
no test coverage detected