How to add title to requestBody and responses in generated OpenApi?
Describe the issue I want to set the title of a requestBody and for responses in my OpenApi yaml but can't see a way to do this. Showing an example just for requestBody below.
To Reproduce
Steps to reproduce the behavior:
Add an OpenApiRequestBody attribute to a POST Azure function, e.g.:
[FunctionName("MyFunction")]
[OpenApiOperation(operationId: "my-operation-id")]
[OpenApiRequestBody(
contentType: "application/json",
bodyType: typeof(MyFunctionInputModel))]
[OpenApiResponseWithBody(
statusCode: HttpStatusCode.OK,
contentType: "application/json",
bodyType: typeof(MyFunctionResponseDto))]
public async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "my-path")] MyFunctionInputModel inputModel)
{
...
}
Expected behavior That the above generates a spec something like:
...
paths:
/my-path:
post:
summary: my-operation-id
operationId: my-operation-id
requestBody:
content:
application/json:
schema:
type: object
title: MyFunctionInputModel
properties:
someProperty:
type: string
someOtherProperty:
type: boolean
...
Instead the above is generated without:
title: MyFunctionInputModel
Environment (please complete the following information, if applicable):
- OS: Windows 10 locally (also generating spec on a win-2019 DevOps build agent
- Browser: Chrome locally (running functions using Azure Function core tools v3 in DevOps followed by a curl request to generate the OpenApi)
- Version: Microsoft.Azure.WebJobs.Extensions.OpenApi v1.2 (in process model)
Additional context I'm using the generated spec in a client code generator and this code generator needs the title in order to name generated classes correctly. Am I correct in thinking this should be done
@macux Thanks for addressing this issue. The ``title` attribute is not supported yet.