(security: HttpApiSecurity)
| 889 | } |
| 890 | |
| 891 | const 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 | |
| 927 | const securitySchemeForComparison = (scheme: OpenAPISecurityScheme): OpenAPISecurityScheme => { |
| 928 | if (scheme.type === "http") { |
no test coverage detected