papsign / Ktor-OpenAPI-Generator

Ktor OpenAPI/Swagger 3 Generator
Apache License 2.0
244 stars 42 forks source link

@HeaderParam is adding header to request body instead of request header #127

Closed ash4317 closed 2 years ago

ash4317 commented 2 years ago

I am using a DemoClass as my request class in which I have one header. I am using @HeaderParam annotation to do this. Here is my DemoClass -

@Request("Request class")
data class DemoClass(
    @HeaderParam("Header required in request")
    val xyz: String,
    @PathParam("Name")
    val name: String
)

On running the app and opening the documentation, I see the header xyz in request body instead of being shown as a header. Even when I make a request, I have to add xyz inside the request body instead of the header. Screenshot (67) Screenshot (66)

I checked a closed issue where header name in backticks and "-" was the solution suggested, but it still didn't work for me. Someone also suggested to use @OpenAPIName with @HeaderParam but the issue still persists. Any way to fix this?