VaporOpenAPI
VaporOpenAPI copied to clipboard
Authorization header in RouteContext
How can I define the Authorization header? The following doesn't work:
internal struct MyRouteContext: RouteContext {
internal let success: ResponseContext<String> = .init { (response) in
response.status = .ok
response.version = .http1_1
response.headers = [
HTTPHeaders.Name.authorization.description: "Bearer",
HTTPHeaders.Name.contentType.description: HTTPMediaType.json.serialize()
]
}
...
}
This question is related to https://github.com/mattpolzin/VaporOpenAPI/issues/11. In short, this is not supported yet. It would be a nice enhancement. I think ideally the authorization information would be encoded as an OpenAPI security scheme even (above and beyond being a header).