MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeSecurityScheme

Function makeSecurityScheme

packages/effect/src/unstable/httpapi/OpenApi.ts:891–925  ·  view source on GitHub ↗
(security: HttpApiSecurity)

Source from the content-addressed store, hash-verified

889}
890
891const makeSecurityScheme = (security: HttpApiSecurity): OpenAPISecurityScheme => {
892 const meta: Partial<OpenAPISecurityScheme> = {}
893 processAnnotation(security.annotations, Description, (description) => {
894 meta.description = description
895 })
896 switch (security._tag) {
897 case "Basic": {
898 return {
899 ...meta,
900 type: "http",
901 scheme: "basic"
902 }
903 }
904 case "Http": {
905 const format = Context.getOption(security.annotations, Format).pipe(
906 Option.map((format) => ({ bearerFormat: format })),
907 Option.getOrUndefined
908 )
909 return {
910 ...meta,
911 type: "http",
912 scheme: security.scheme,
913 ...format
914 }
915 }
916 case "ApiKey": {
917 return {
918 ...meta,
919 type: "apiKey",
920 name: security.key,
921 in: security.in
922 }
923 }
924 }
925}
926
927const securitySchemeForComparison = (scheme: OpenAPISecurityScheme): OpenAPISecurityScheme => {
928 if (scheme.type === "http") {

Callers 1

processHttpApiSecurityFunction · 0.85

Calls 3

processAnnotationFunction · 0.85
pipeMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected