(security: HttpApiSecurity)
| 450 | } |
| 451 | |
| 452 | const makeSecurityScheme = (security: HttpApiSecurity): OpenAPISecurityScheme => { |
| 453 | const meta: Partial<OpenAPISecurityScheme> = {} |
| 454 | processAnnotation(security.annotations, Description, (description) => { |
| 455 | meta.description = description |
| 456 | }) |
| 457 | switch (security._tag) { |
| 458 | case "Basic": { |
| 459 | return { |
| 460 | ...meta, |
| 461 | type: "http", |
| 462 | scheme: "basic" |
| 463 | } |
| 464 | } |
| 465 | case "Bearer": { |
| 466 | const format = Context.getOption(security.annotations, Format).pipe( |
| 467 | Option.map((format) => ({ bearerFormat: format })), |
| 468 | Option.getOrUndefined |
| 469 | ) |
| 470 | return { |
| 471 | ...meta, |
| 472 | type: "http", |
| 473 | scheme: "bearer", |
| 474 | ...format |
| 475 | } |
| 476 | } |
| 477 | case "ApiKey": { |
| 478 | return { |
| 479 | ...meta, |
| 480 | type: "apiKey", |
| 481 | name: security.key, |
| 482 | in: security.in |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | /** |
| 489 | * This model describes the OpenAPI specification (version 3.1.0) returned by |
no test coverage detected