( rawParameters: unknown[], root: UnknownRecord, )
| 186 | } |
| 187 | |
| 188 | function parseParameters( |
| 189 | rawParameters: unknown[], |
| 190 | root: UnknownRecord, |
| 191 | ): { |
| 192 | headers: HttpHeaderEntry[] |
| 193 | pathExamples: Record<string, string> |
| 194 | query: HttpQueryEntry[] |
| 195 | } { |
| 196 | const headers: HttpHeaderEntry[] = [] |
| 197 | const pathExamples: Record<string, string> = {} |
| 198 | const query: HttpQueryEntry[] = [] |
| 199 | |
| 200 | for (const rawParameter of rawParameters) { |
| 201 | const parameter = resolveRef(root, rawParameter) |
| 202 | if (!isRecord(parameter)) |
| 203 | continue |
| 204 | |
| 205 | const name = asString(parameter.name) |
| 206 | if (!name) |
| 207 | continue |
| 208 | |
| 209 | const entry = { |
| 210 | description: asString(parameter.description) || undefined, |
| 211 | key: name, |
| 212 | value: getParameterValue(parameter), |
| 213 | } |
| 214 | |
| 215 | if (parameter.in === 'query') { |
| 216 | query.push(entry) |
| 217 | continue |
| 218 | } |
| 219 | |
| 220 | if (parameter.in === 'header') { |
| 221 | headers.push(entry) |
| 222 | continue |
| 223 | } |
| 224 | |
| 225 | if (parameter.in === 'path') { |
| 226 | pathExamples[name] = entry.value |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | return { headers, pathExamples, query } |
| 231 | } |
| 232 | |
| 233 | function mergeQueryEntries( |
| 234 | urlQuery: HttpQueryEntry[], |
no test coverage detected