(type: AST.AST)
| 356 | }> => { |
| 357 | const members = new Map(inherited) |
| 358 | function process(type: AST.AST) { |
| 359 | if (AST.isNeverKeyword(type)) { |
| 360 | return |
| 361 | } |
| 362 | const annotations = HttpApiSchema.extractAnnotations(ast.annotations) |
| 363 | // Avoid changing the reference unless necessary |
| 364 | // Otherwise, deduplication of the ASTs below will not be possible |
| 365 | if (!Record.isEmptyRecord(annotations)) { |
| 366 | type = AST.annotations(type, { |
| 367 | ...annotations, |
| 368 | ...type.annotations |
| 369 | }) |
| 370 | } |
| 371 | const status = getStatus(type) |
| 372 | const emptyDecodeable = HttpApiSchema.getEmptyDecodeable(type) |
| 373 | const current = members.get(status) |
| 374 | members.set( |
| 375 | status, |
| 376 | { |
| 377 | description: (current ? current.description : Option.none()).pipe( |
| 378 | Option.orElse(() => getDescriptionOrIdentifier(type)) |
| 379 | ), |
| 380 | ast: (current ? current.ast : Option.none()).pipe( |
| 381 | // Deduplicate the ASTs |
| 382 | Option.map((current) => HttpApiSchema.UnionUnifyAST(current, type)), |
| 383 | Option.orElse(() => |
| 384 | !emptyDecodeable && AST.isVoidKeyword(AST.encodedAST(type)) ? Option.none() : Option.some(type) |
| 385 | ) |
| 386 | ) |
| 387 | } |
| 388 | ) |
| 389 | } |
| 390 | |
| 391 | HttpApiSchema.extractUnionTypes(ast).forEach(process) |
| 392 | return members |
no test coverage detected