(structure: SpecStructure)
| 265 | /** Parse the concatenation of the head ranges into the document head (openapi, |
| 266 | * info, servers, tags). Small; safe to materialize whole. */ |
| 267 | export const parseHead = (structure: SpecStructure): Record<string, unknown> => { |
| 268 | const text = structure.headRanges.map((r) => structure.text.slice(r.start, r.end)).join(""); |
| 269 | const parsed = parseYaml(text); |
| 270 | return parsed && typeof parsed === "object" && !Array.isArray(parsed) |
| 271 | ? (parsed as Record<string, unknown>) |
| 272 | : {}; |
| 273 | }; |
| 274 | |
| 275 | /** Parse the small component subkeys (parameters / requestBodies / responses) |
| 276 | * into a `components`-shaped object for `$ref` resolution. */ |
no test coverage detected