I generated swagger for micronaut using the instructions provided in https://micronaut-projects.github.io/micronaut-openapi/latest/guide/index.html
So I have a controller method like:
@Consumes("application/vnd.api+json")
@Produces("application/vnd.api+json")
@Post("/{id}/users")
@RequestBody
public HttpResponse addAndAssignTarget(@PathVariable("id") Long projectId, @Body @Parameter() JsonNode user) {
I am not using a POJO for adding users for another reason which is out of context for this question. Thus, the generated swagger ui shows {} as example for request body. I would like to change this to something like. How can I do this?
{
"data" : {
"type": "projects",
"attributes": {
"name": "some-name1",
"description": "some-description",
"partner_company": "some-compnay"
}
}
}