0
votes

I've created an Azure Function with OpenAPI support. I have

[FunctionName("MyFunc")]
[OpenApiOperation(operationId: "Run")]
[OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)]
[OpenApiParameter(name: "page", In = ParameterLocation.Query, Required = false, Type = typeof(int), Description = "The **page** parameter")]
[OpenApiParameter(name: "itemsPerPage", In = ParameterLocation.Query, Required = false, Type = typeof(int), Description = "The **itemsPerPage** parameter")]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ResultData), Description = "The OK response")]
        public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req)
{
...
}

I have a settings called enablePagination that would return a paginated items to client if it is true. In Swagger UI page, will see page and itemsPerPage open api parameters. Also response type is returning a kind of object.

In case when I want to put enablePagination on false, I want to hide page and itemsPerPage from Swagger page, and change response body object.

How to do that ?