MCPcopy Index your code
hub / github.com/Effect-TS/effect / makeSecurityScheme

Function makeSecurityScheme

packages/platform/src/OpenApi.ts:452–486  ·  view source on GitHub ↗
(security: HttpApiSecurity)

Source from the content-addressed store, hash-verified

450}
451
452const 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

Callers 1

processHttpApiSecurityFunction · 0.85

Calls 4

processAnnotationFunction · 0.85
pipeMethod · 0.65
getOptionMethod · 0.65
mapMethod · 0.65

Tested by

no test coverage detected