srramasw
4 years agoNew Member
How to specify request headers for a post method
I have a method like the following in my spring boot based web service. I am trying to generate open api spec for the following using swagger core annotations. I would like to add all the acceptable headers to the spec file. I am wondering how to do that with annotations.
@POST
@Produces({ MediaType.APPLICATION_JSON + ";charset=UTF-8" })
@Operation(description = "This is my api")
//1. overall Header annotations
public Response post(@Context HttpHeaders headers, //2. header parameters
@Context UriInfo uriInfo,
@RequestBody MyRequest myRequest) {
I am wondering where to put the annotations to list the headers. Also how to list all the headers. I saw many examples of headers in ApiResponse, but i am trying to add request header.
Thanks
Srini