javalin / javalin-openapi

Annotation processor for compile-time OpenAPI & JsonSchema, with out-of-the-box support for Javalin 5.x, Swagger & ReDoc
https://github.com/javalin/javalin-openapi/wiki
Apache License 2.0
45 stars 17 forks source link

Response Headers are not possible to defined #211

Closed mzielinski closed 7 months ago

mzielinski commented 7 months ago

Currently, we are not able to define headers for responses.

It would be good to have such possibility, the same as we can do it for requests.

dzikoysk commented 7 months ago

It's now possible as follows:

responses = {
    @OpenApiResponse(
        status = "400",
        content = @OpenApiContent(from = EntityDto[].class),
        headers = {
            @OpenApiParam(name = "X-Error-Message", description = "Error message", type = String.class)
        }
    )
}

You can use 6.0.1-SNAPSHOT or wait for the next stable release :)