VaporOpenAPI icon indicating copy to clipboard operation
VaporOpenAPI copied to clipboard

Header requirements

Open GiacomoLeopizzi opened this issue 4 years ago • 1 comments

Hi! I was using your library for my vapor project and I couldn't find a way to introduce header requirements (like Authentication) into the output. Is there something I'm missing out?

Thanks in advance

GiacomoLeopizzi avatar Sep 13 '21 12:09 GiacomoLeopizzi

I never did get around to adding header support to this library. OpenAPIKit supports header parameters, there just isn't any code in VaporOpenAPI that generates them.

The code would probably go here (if you or someone else wanted to add support for this): https://github.com/mattpolzin/VaporOpenAPI/blob/main/Sources/VaporOpenAPI/VaporRoute%2BOpenAPI.swift#L120..L121

Headers are parameters in OpenAPI just like query & path but with the location of .header.

It would be cool to grab header information from Vapor or from VaporTypedRoutes, but you could also probably provide yourself a hook to inject headers from the side (less elegant, but less code).

mattpolzin avatar Sep 15 '21 01:09 mattpolzin