Посмотрите на следующий код:
Код: Выделить всё
[Function("v1/job/selectAll/{agentId}")]
[OpenApiOperation(operationId: "selectAllJpbs", tags: new[] { nameof(TctJob) }, Summary = "Select all jobs.", Description = "This select all the jobs of an agent.", Visibility = OpenApiVisibilityType.Important)]
//[OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))]
[OpenApiParameter(name: "agentId", In = ParameterLocation.Query, Description = "The id of the agent to download the jobs", Required = true, Type = typeof(Guid))]
//[OpenApiRequestBody(contentType: "application/json", bodyType: typeof(List), Required = true, Description = "List of all the jobs of the requested agent.")]
//[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(System.Collections.Generic.List), Summary = "Job list.", Description = "List of all the jobs.")]
[OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")]
[OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "", Description = "")]
[OpenApiResponseWithoutBody(statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Validation exception", Description = "Validation exception")]
public async Task SelectAllJobs(
[HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req,
[FromRoute(Name = "agentId")] Guid agentId)
{ ... }
Код: Выделить всё
.../api/swagger/uiТеперь, если я удалю комментарий из строки OpenApiRequestBody или OpenApiResponseWithBody, я получаю следующую ошибку:
Ошибка получения. Внутренняя ошибка сервера http://localhost:7031/api/swagger.json
Обратите внимание, что файл swagger.json находится именно там, где и должен быть...
Некоторая информация о среде:
- Целевая платформа: .Net 6
- Версия функции Azure: 4
- AzureExtensions.Swashbuckle: 3.3.2
Код: Выделить всё
net6.0
v4
Exe
1.0.0
1.0.0
The Cloud Team
The Cloud Team
This package contains the Database Updater service.
PreserveNewest
PreserveNewest
Never
С уважением,
Аттилио
Подробнее здесь: https://stackoverflow.com/questions/766 ... er-openapi
Мобильная версия