diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 85ce8ca6..a865488c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # [Choice] .NET version: 6.0-bullseye-slim, 6.0-jammy, 6.0-focal -ARG VARIANT="6.0-jammy" +ARG VARIANT="7.0-jammy" FROM mcr.microsoft.com/dotnet/sdk:${VARIANT} # [Optional] Uncomment this section to install additional OS packages. diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4a716daf..48e79d67 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,16 +1,16 @@ { "name": "DevContainer for .NET", - + "build": { "dockerfile": "./Dockerfile", "context": ".", "args": { - "VARIANT": "6.0-jammy" + "VARIANT": "7.0-jammy" // Use this only if you need Razor support, until OmniSharp supports .NET 6 properly // "VARIANT": "6.0-focal" } }, - + // Use 'forwardPorts' to make a list of ports inside the container available locally. "forwardPorts": [ // Azure Functions @@ -22,25 +22,25 @@ // Azure Static Web Apps // 4280 ], - + "features": { // Uncomment the below to install Azure CLI "ghcr.io/devcontainers/features/azure-cli:1": { "version": "latest" }, - + // Uncomment the below to install GitHub CLI "ghcr.io/devcontainers/features/github-cli:1": { "version": "latest" }, - + // Uncomment the below to install node.js "ghcr.io/devcontainers/features/node:1": { "version": "lts", "nodeGypDependencies": true, "nvmInstallPath": "/usr/local/share/nvm" }, - + // Install common utilities "ghcr.io/devcontainers/features/common-utils:1": { "installZsh": true, @@ -51,11 +51,11 @@ "gid": "1000" } }, - + "overrideFeatureInstallOrder": [ "ghcr.io/devcontainers/features/common-utils" ], - + // Configure tool-specific properties. "customizations": { // Configure properties specific to VS Code. @@ -65,32 +65,32 @@ // Recommended extensions - GitHub "cschleiden.vscode-github-actions", "GitHub.vscode-pull-request-github", - + // Recommended extensions - Azure "Azurite.azurite", "ms-azuretools.vscode-bicep", - + // Recommended extensions - Collaboration "eamodio.gitlens", "EditorConfig.EditorConfig", // "MS-vsliveshare.vsliveshare-pack", "streetsidesoftware.code-spell-checker", - + // Recommended extensions - .NET "Fudge.auto-using", "jongrant.csharpsortusings", "kreativ-software.csharpextensions", - + // Recommended extensions - Power Platform // "microsoft-IsvExpTools.powerplatform-vscode", - + // Recommended extensions - Markdown "bierner.github-markdown-preview", "DavidAnson.vscode-markdownlint", "docsmsft.docs-linting", "johnpapa.read-time", "yzhang.markdown-all-in-one", - + // Required extensions "GitHub.copilot", "ms-dotnettools.csharp", @@ -98,7 +98,7 @@ "ms-vscode.vscode-node-azure-pack", "VisualStudioExptTeam.vscodeintellicode" ], - + "settings": { // Uncomment if you want to use zsh as the default shell "terminal.integrated.defaultProfile.linux": "zsh", @@ -107,13 +107,13 @@ "path": "/usr/bin/zsh" } }, - + // Uncomment if you want to use CaskaydiaCove Nerd Font as the default terminal font "terminal.integrated.fontFamily": "CaskaydiaCove Nerd Font", - + // Uncomment if you want to disable the minimap view "editor.minimap.enabled": false, - + // Recommended settings for the explorer pane "explorer.sortOrder": "type", "explorer.fileNesting.enabled": true, @@ -125,14 +125,13 @@ } } }, - + // Uncomment if you want to use bash in 'postCreateCommand' after the container is created // "postCreateCommand": "/bin/bash ./.devcontainer/post-create.sh > ~/post-create.log", - + // Uncomment if you want to use zsh in 'postCreateCommand' after the container is created "postCreateCommand": "/usr/bin/zsh ./.devcontainer/post-create.sh > ~/post-create.log", - + // Uncomment if you want to connect other than 'root'. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode" } - \ No newline at end of file diff --git a/README.md b/README.md index 060f2047..89143d75 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,31 @@ # Azure Functions OpenAPI Extension # +Supports multiple HTTP methods on the same endpoint + +``` + [OpenApiOperation(operationId: "containerOperations", tags: new[] { "container" }, Summary = "Operations on containers", Description = "Operations on containers", Visibility = OpenApiVisibilityType.Important)] + //GetOperations + [OpenApiRequestBody(verb: "Get", contentType: "application/json", bodyType: typeof(ContainerGet), Required = true, Description = "Container to get")] + [OpenApiResponseWithBody(verb: "Get", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ContainerGet), Description = "Gets container info")] + [OpenApiResponseWithoutBody(verb: "Get", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid container supplied", Description = "Invalid container supplied")] + //DeleteOperations + [OpenApiRequestBody(verb: "Delete", contentType: "application/json", bodyType: typeof(ContainerDelete), Required = true, Description = "Container to delete")] + [OpenApiResponseWithBody(verb: "Delete", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ContainerInfo), Description = "Deletes container")] + [OpenApiResponseWithoutBody(verb: "Delete", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid container supplied", Description = "Invalid container supplied")] + //PostOperations + [OpenApiRequestBody(verb: "Post", contentType: "application/json", bodyType: typeof(ContainerCreate), Required = true, Description = "Container to create")] + [OpenApiResponseWithBody(verb: "Post", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ContainerInfo), Description = "Created container")] + [OpenApiResponseWithoutBody(verb: "Post", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid container supplied", Description = "Invalid container supplied")] + [Function("Containers")] + public Async.Task Run([HttpTrigger(AuthorizationLevel.Anonymous, "GET", "POST", "DELETE")] HttpRequestData req) + => _auth.CallIfUser(req, r => r.Method switch { + "GET" => Get(r), + "POST" => Post(r), + "DELETE" => Delete(r), + _ => throw new NotSupportedException(), + }); +``` + | Out-of-Proc Worker | In-Proc Worker | | :----------------: | :------------: | | [![](https://img.shields.io/nuget/dt/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/) [![](https://img.shields.io/nuget/v/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/) | [![](https://img.shields.io/nuget/dt/Microsoft.Azure.WebJobs.Extensions.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/) [![](https://img.shields.io/nuget/v/Microsoft.Azure.WebJobs.Extensions.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/) | diff --git a/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc.Ping/PingHttpTrigger.cs b/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc.Ping/PingHttpTrigger.cs index 7ae54194..fdcb2b1e 100644 --- a/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc.Ping/PingHttpTrigger.cs +++ b/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc.Ping/PingHttpTrigger.cs @@ -20,7 +20,7 @@ public PingHttpTrigger(ILogger log) [Function(nameof(PingHttpTrigger.Ping))] [OpenApiOperation(operationId: "ping", tags: new[] { "ping" }, Summary = "Pings for health check", Description = "This pings for health check.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Summary = "Successful operation", Description = "Successful operation")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Summary = "Successful operation", Description = "Successful operation")] public async Task Ping( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "ping")] HttpRequestData req) { diff --git a/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/PetHttpTrigger.cs b/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/PetHttpTrigger.cs index 75df3648..6eda8c52 100644 --- a/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/PetHttpTrigger.cs +++ b/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/PetHttpTrigger.cs @@ -34,12 +34,12 @@ public PetHttpTrigger(ILoggerFactory loggerFactory, OpenApiSettings openapi, Fix [Function(nameof(PetHttpTrigger.UpdatePet))] [OpenApiOperation(operationId: "updatePet", tags: new[] { "pet" }, Summary = "Update an existing pet", Description = "This updates an existing pet.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(Pet), Required = true, Description = "Pet object that needs to be updated to the store")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "Pet details updated", Description = "Pet details updated")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Validation exception", Description = "Validation exception")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "PUT", Flows = typeof(PetStoreAuth))] + [OpenApiRequestBody(verb: "PUT", contentType: "application/json", bodyType: typeof(Pet), Required = true, Description = "Pet object that needs to be updated to the store")] + [OpenApiResponseWithBody(verb: "PUT", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "Pet details updated", Description = "Pet details updated")] + [OpenApiResponseWithoutBody(verb: "PUT", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + [OpenApiResponseWithoutBody(verb: "PUT", statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] + [OpenApiResponseWithoutBody(verb: "PUT", statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Validation exception", Description = "Validation exception")] public async Task UpdatePet( [HttpTrigger(AuthorizationLevel.Anonymous, "PUT", Route = "pet")] HttpRequestData req) { @@ -54,10 +54,10 @@ public async Task UpdatePet( [Function(nameof(PetHttpTrigger.AddPet))] [OpenApiOperation(operationId: "addPet", tags: new[] { "pet" }, Summary = "Add a new pet to the store", Description = "This add a new pet to the store.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(Pet), Required = true, Description = "Pet object that needs to be added to the store")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "New pet details added", Description = "New pet details added")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Invalid input", Description = "Invalid input")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "POST", Flows = typeof(PetStoreAuth))] + [OpenApiRequestBody(verb: "POST", contentType: "application/json", bodyType: typeof(Pet), Required = true, Description = "Pet object that needs to be added to the store")] + [OpenApiResponseWithBody(verb: "POST", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "New pet details added", Description = "New pet details added")] + [OpenApiResponseWithoutBody(verb: "POST", statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Invalid input", Description = "Invalid input")] public async Task AddPet( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "pet")] HttpRequestData req) { @@ -72,10 +72,10 @@ public async Task AddPet( [Function(nameof(PetHttpTrigger.FindByStatus))] [OpenApiOperation(operationId: "findPetsByStatus", tags: new[] { "pet" }, Summary = "Finds Pets by status", Description = "Multiple status values can be provided with comma separated strings.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiParameter(name: "status", In = ParameterLocation.Query, Required = true, Type = typeof(List), Explode = true, Summary = "Pet status value", Description = "Status values that need to be considered for filter", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid status value", Description = "Invalid status value")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "GET", Flows = typeof(PetStoreAuth))] + [OpenApiParameter(verb: "GET", name: "status", In = ParameterLocation.Query, Required = true, Type = typeof(List), Explode = true, Summary = "Pet status value", Description = "Status values that need to be considered for filter", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid status value", Description = "Invalid status value")] public async Task FindByStatus( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "pet/findByStatus")] HttpRequestData req) { @@ -99,10 +99,10 @@ public async Task FindByStatus( [Function(nameof(PetHttpTrigger.FindByTags))] [OpenApiOperation(operationId: "findPetsByTags", tags: new[] { "pet" }, Summary = "Finds Pets by tags", Description = "Muliple tags can be provided with comma separated strings.", Deprecated = true, Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiParameter(name: "tags", In = ParameterLocation.Query, Required = true, Type = typeof(List), Explode = true, Summary = "Tags to filter by", Description = "Tags to filter by", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid tag value", Description = "Invalid tag value")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "GET", Flows = typeof(PetStoreAuth))] + [OpenApiParameter(verb: "GET", name: "tags", In = ParameterLocation.Query, Required = true, Type = typeof(List), Explode = true, Summary = "Tags to filter by", Description = "Tags to filter by", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid tag value", Description = "Invalid tag value")] public async Task FindByTags( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "pet/findByTags")] HttpRequestData req) { @@ -131,11 +131,11 @@ public async Task FindByTags( [Function(nameof(PetHttpTrigger.GetPetById))] [OpenApiOperation(operationId: "getPetById", tags: new[] { "pet" }, Summary = "Find pet by ID", Description = "Returns a single pet.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("api_key", SecuritySchemeType.ApiKey, Name = "api_key", In = OpenApiSecurityLocationType.Header)] - [OpenApiParameter(name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet to return", Description = "ID of pet to return", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] + [OpenApiSecurity("api_key", SecuritySchemeType.ApiKey, "GET", Name = "api_key", In = OpenApiSecurityLocationType.Header)] + [OpenApiParameter(verb: "GET", name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet to return", Description = "ID of pet to return", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] public async Task GetPetById( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "pet/{petId}")] HttpRequestData req, long petId) { @@ -152,11 +152,11 @@ public async Task GetPetById( [Function(nameof(PetHttpTrigger.UpdatePetWithForm))] [OpenApiOperation(operationId: "updatePetWithForm", tags: new[] { "pet" }, Summary = "Updates a pet in the store with form data", Description = "This updates a pet in the store with form data.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiParameter(name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet that needs to be updated", Description = "ID of pet that needs to be updated", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "application/x-www-form-urlencoded", bodyType: typeof(PetUrlForm), Required = true, Description = "Pet object that needs to be added to the store")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Invalid input", Description = "Invalid input")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "POST", Flows = typeof(PetStoreAuth))] + [OpenApiParameter(verb: "POST", name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet that needs to be updated", Description = "ID of pet that needs to be updated", Visibility = OpenApiVisibilityType.Important)] + [OpenApiRequestBody(verb: "POST", contentType: "application/x-www-form-urlencoded", bodyType: typeof(PetUrlForm), Required = true, Description = "Pet object that needs to be added to the store")] + [OpenApiResponseWithBody(verb: "POST", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "POST", statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Invalid input", Description = "Invalid input")] public async Task UpdatePetWithForm( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "pet/{petId}")] HttpRequestData req, long petId) { @@ -173,12 +173,12 @@ public async Task UpdatePetWithForm( [Function(nameof(PetHttpTrigger.DeletePet))] [OpenApiOperation(operationId: "deletePet", tags: new[] { "pet" }, Summary = "Deletes a pet", Description = "This deletes a pet.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiParameter(name: "api_key", In = ParameterLocation.Header, Type = typeof(string), Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "Pet id to delete", Description = "Pet id to delete", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.OK, Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "DELETE", Flows = typeof(PetStoreAuth))] + [OpenApiParameter(verb: "DELETE", name: "api_key", In = ParameterLocation.Header, Type = typeof(string), Visibility = OpenApiVisibilityType.Important)] + [OpenApiParameter(verb: "DELETE", name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "Pet id to delete", Description = "Pet id to delete", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithoutBody(verb: "DELETE", statusCode: HttpStatusCode.OK, Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "DELETE", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + [OpenApiResponseWithoutBody(verb: "DELETE", statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] public async Task DeletePet( [HttpTrigger(AuthorizationLevel.Anonymous, "DELETE", Route = "pet/{petId}")] HttpRequestData req, long petId) { @@ -191,10 +191,10 @@ public async Task DeletePet( [Function(nameof(PetHttpTrigger.UploadFile))] [OpenApiOperation(operationId: "uploadFile", tags: new[] { "pet" }, Summary = "Uploads an image", Description = "This uploads an image.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiParameter(name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet to update", Description = "ID of pet to update", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "multipart/form-data", bodyType: typeof(PetFormData))] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ApiResponse), Summary = "successful operation", Description = "successful operation")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "POST", Flows = typeof(PetStoreAuth))] + [OpenApiParameter(verb: "POST", name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet to update", Description = "ID of pet to update", Visibility = OpenApiVisibilityType.Important)] + [OpenApiRequestBody(verb: "POST", contentType: "multipart/form-data", bodyType: typeof(PetFormData))] + [OpenApiResponseWithBody(verb: "POST", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ApiResponse), Summary = "successful operation", Description = "successful operation")] public async Task UploadFile( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "pet/{petId}/uploadImage")] HttpRequestData req, long petId) { diff --git a/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/StoreHttpTrigger.cs b/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/StoreHttpTrigger.cs index 2939d6ef..63905625 100644 --- a/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/StoreHttpTrigger.cs +++ b/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/StoreHttpTrigger.cs @@ -30,10 +30,10 @@ public StoreHttpTrigger(ILoggerFactory loggerFactory, OpenApiSettings openapi, F [Function(nameof(StoreHttpTrigger.GetInventory))] [OpenApiOperation(operationId: "getInventory", tags: new[] { "store" }, Summary = "Returns pet inventories by status", Description = "This returns a map of status codes to quantities.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("api_key", SecuritySchemeType.ApiKey, Name = "api_key", In = OpenApiSecurityLocationType.Header)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Dictionary), Description = "Successful operation")] + [OpenApiSecurity("api_key", SecuritySchemeType.ApiKey, "Get", Name = "api_key", In = OpenApiSecurityLocationType.Header)] + [OpenApiResponseWithBody(verb: "Get", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Dictionary), Description = "Successful operation")] public async Task GetInventory( - [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "store/inventory")] HttpRequestData req) + [HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = "store/inventory")] HttpRequestData req) { this._logger.LogInformation($"document title: {this._openapi.DocTitle}"); @@ -48,9 +48,9 @@ public async Task GetInventory( [Function(nameof(StoreHttpTrigger.PlaceOrder))] [OpenApiOperation(operationId: "placeOrder", tags: new[] { "store" }, Summary = "Places an order for a pet", Description = "This places an order for a pet.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(Order), Required = true, Description = "Order placed for purchasing the pet")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Order), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid input", Description = "Invalid input")] + [OpenApiRequestBody(verb: "POST", contentType: "application/json", bodyType: typeof(Order), Required = true, Description = "Order placed for purchasing the pet")] + [OpenApiResponseWithBody(verb: "POST", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Order), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "POST", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid input", Description = "Invalid input")] public async Task PlaceOrder( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "store/order")] HttpRequestData req) { @@ -63,14 +63,41 @@ public async Task PlaceOrder( return await Task.FromResult(response).ConfigureAwait(false); } - [Function(nameof(StoreHttpTrigger.GetOrderById))] - [OpenApiOperation(operationId: "getOrderById", tags: new[] { "store" }, Summary = "Finds purchase order by ID", Description = "This finds purchase order by ID.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "orderId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of order that needs to be fetched", Description = "ID of order that needs to be fetched", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Order), Description = "Successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Order not found", Description = "Order not found")] + [OpenApiOperation(operationId: "orderOperations", tags: new[] { "store" }, Summary = "Operations on order", Description = "Operations on order", Visibility = OpenApiVisibilityType.Important)] + //GetOperations + [OpenApiParameter(verb: "Get", name: "orderId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of order that needs to be fetched", Description = "ID of order that needs to be fetched", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "Get", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Order), Description = "Successful operation")] + [OpenApiResponseWithoutBody(verb: "Get", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + [OpenApiResponseWithoutBody(verb: "Get", statusCode: HttpStatusCode.NotFound, Summary = "Order not found", Description = "Order not found")] + //DeleteOperations + [OpenApiParameter(verb: "Delete", name: "orderId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of order that needs to be deleted", Description = "ID of order that needs to be deleted", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithoutBody(verb: "Delete", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + [OpenApiResponseWithoutBody(verb: "Delete", statusCode: HttpStatusCode.NotFound, Summary = "Order not found", Description = "Order not found")] + [Function("OrderOperations")] + public async Task OrderOperations( + [HttpTrigger(AuthorizationLevel.Anonymous, "Get", "Delete", Route = "store/order/{orderId}")] HttpRequestData req, long orderId) + { + switch (req.Method) + { + case "Get": + return await this.GetOrderById(req, orderId).ConfigureAwait(false); + + case "Delete": + return await this.DeleteOrder(req, orderId).ConfigureAwait(false); + + default: + return req.CreateResponse(HttpStatusCode.MethodNotAllowed); + } + } + + // [Function(nameof(StoreHttpTrigger.GetOrderById))] + // [OpenApiOperation(operationId: "getOrderById", tags: new[] { "store" }, Summary = "Finds purchase order by ID", Description = "This finds purchase order by ID.", Visibility = OpenApiVisibilityType.Important)] + // [OpenApiParameter(verb: "Get", name: "orderId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of order that needs to be fetched", Description = "ID of order that needs to be fetched", Visibility = OpenApiVisibilityType.Important)] + // [OpenApiResponseWithBody(verb: "Get", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Order), Description = "Successful operation")] + // [OpenApiResponseWithoutBody(verb: "Get", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + // [OpenApiResponseWithoutBody(verb: "Get", statusCode: HttpStatusCode.NotFound, Summary = "Order not found", Description = "Order not found")] public async Task GetOrderById( - [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "store/order/{orderId}")] HttpRequestData req, long orderId) + [HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = "store/order/{orderId}")] HttpRequestData req, long orderId) { this._logger.LogInformation($"document title: {this._openapi.DocTitle}"); @@ -83,13 +110,13 @@ public async Task GetOrderById( return await Task.FromResult(response).ConfigureAwait(false); } - [Function(nameof(StoreHttpTrigger.DeleteOrder))] - [OpenApiOperation(operationId: "deleteOrder", tags: new[] { "store" }, Summary = "Deletes purchase order by ID", Description = "For valid response try integer IDs with positive integer value. Negative or non - integer values will generate API errors.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "orderId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of order that needs to be deleted", Description = "ID of order that needs to be deleted", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Order not found", Description = "Order not found")] + // [Function(nameof(StoreHttpTrigger.DeleteOrder))] + // [OpenApiOperation(operationId: "deleteOrder", tags: new[] { "store" }, Summary = "Deletes purchase order by ID", Description = "For valid response try integer IDs with positive integer value. Negative or non - integer values will generate API errors.", Visibility = OpenApiVisibilityType.Important)] + // [OpenApiParameter(verb: "Delete", name: "orderId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of order that needs to be deleted", Description = "ID of order that needs to be deleted", Visibility = OpenApiVisibilityType.Important)] + // [OpenApiResponseWithoutBody(verb: "Delete", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + // [OpenApiResponseWithoutBody(verb: "Delete", statusCode: HttpStatusCode.NotFound, Summary = "Order not found", Description = "Order not found")] public async Task DeleteOrder( - [HttpTrigger(AuthorizationLevel.Anonymous, "DELETE", Route = "store/order/{orderId}")] HttpRequestData req, long orderId) + [HttpTrigger(AuthorizationLevel.Anonymous, "Delete", Route = "store/order/{orderId}")] HttpRequestData req, long orderId) { this._logger.LogInformation($"document title: {this._openapi.DocTitle}"); diff --git a/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/UserHttpTrigger.cs b/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/UserHttpTrigger.cs index 2dfb3c6a..9d943e98 100644 --- a/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/UserHttpTrigger.cs +++ b/samples/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.FunctionApp.OutOfProc/UserHttpTrigger.cs @@ -32,8 +32,8 @@ public UserHttpTrigger(ILoggerFactory loggerFactory, OpenApiSettings openapi, Fi [Function(nameof(UserHttpTrigger.CreateUser))] [OpenApiOperation(operationId: "createUser", tags: new[] { "user" }, Summary = "Creates user", Description = "This can only be done by the logged in user.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(User), Required = true, Description = "Created user object")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(User), Summary = "successful operation", Description = "successful operation")] + [OpenApiRequestBody(verb: "POST", contentType: "application/json", bodyType: typeof(User), Required = true, Description = "Created user object")] + [OpenApiResponseWithBody(verb: "POST", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(User), Summary = "successful operation", Description = "successful operation")] public async Task CreateUser( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "user")] HttpRequestData req) { @@ -48,8 +48,8 @@ public async Task CreateUser( [Function(nameof(UserHttpTrigger.CreateUsersWithArrayInput))] [OpenApiOperation(operationId: "createUsersWithArrayInput", tags: new[] { "user" }, Summary = "Creates list of users with given input array", Description = "This Creates list of users with given input array.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(List), Required = true, Description = "List of user object")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] + [OpenApiRequestBody(verb: "POST", contentType: "application/json", bodyType: typeof(List), Required = true, Description = "List of user object")] + [OpenApiResponseWithBody(verb: "POST", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] public async Task CreateUsersWithArrayInput( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "user/createWithArray")] HttpRequestData req) { @@ -64,8 +64,8 @@ public async Task CreateUsersWithArrayInput( [Function(nameof(UserHttpTrigger.CreateUsersWithListInput))] [OpenApiOperation(operationId: "createUsersWithListInput", tags: new[] { "user" }, Summary = "Creates list of users with given input array", Description = "This Creates list of users with given input array.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(List), Required = true, Description = "List of user object")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] + [OpenApiRequestBody(verb: "POST", contentType: "application/json", bodyType: typeof(List), Required = true, Description = "List of user object")] + [OpenApiResponseWithBody(verb: "POST", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] public async Task CreateUsersWithListInput( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "user/createWithList")] HttpRequestData req) { @@ -80,9 +80,9 @@ public async Task CreateUsersWithListInput( [Function(nameof(UserHttpTrigger.LoginUser))] [OpenApiOperation(operationId: "loginUser", tags: new[] { "user" }, Summary = "Logs user into the system", Description = "This logs user into the system.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "username", In = ParameterLocation.Query, Required = true, Type = typeof(string), Summary = "The user name for login", Description = "The user name for login", Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "password", In = ParameterLocation.Query, Required = true, Type = typeof(string), Summary = "The password for login in clear text", Description = "The password for login in clear text", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), CustomHeaderType = typeof(LoginUserResponseHeader), Summary = "successful operation", Description = "successful operation")] + [OpenApiParameter(verb: "GET", name: "username", In = ParameterLocation.Query, Required = true, Type = typeof(string), Summary = "The user name for login", Description = "The user name for login", Visibility = OpenApiVisibilityType.Important)] + [OpenApiParameter(verb: "GET", name: "password", In = ParameterLocation.Query, Required = true, Type = typeof(string), Summary = "The password for login in clear text", Description = "The password for login in clear text", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), CustomHeaderType = typeof(LoginUserResponseHeader), Summary = "successful operation", Description = "successful operation")] public async Task LoginUser( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "user/login")] HttpRequestData req) { @@ -100,7 +100,7 @@ public async Task LoginUser( [Function(nameof(UserHttpTrigger.LogoutUser))] [OpenApiOperation(operationId: "logoutUser", tags: new[] { "user" }, Summary = "Logs out current logged in user session", Description = "This logs out current logged in user session.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.OK, Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.OK, Summary = "successful operation", Description = "successful operation")] public async Task LogoutUser( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "user/logout")] HttpRequestData req) { @@ -113,10 +113,10 @@ public async Task LogoutUser( [Function(nameof(UserHttpTrigger.GetUserByName))] [OpenApiOperation(operationId: "getUserByName", tags: new[] { "user" }, Summary = "Gets user by user name", Description = "This gets user by user name.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "username", In = ParameterLocation.Path, Required = true, Type = typeof(string), Summary = "The user name for login", Description = "The user name for login", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(User), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid username supplied", Description = "Invalid username supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "User not found", Description = "User not found")] + [OpenApiParameter(verb: "GET", name: "username", In = ParameterLocation.Path, Required = true, Type = typeof(string), Summary = "The user name for login", Description = "The user name for login", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(User), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid username supplied", Description = "Invalid username supplied")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.NotFound, Summary = "User not found", Description = "User not found")] public async Task GetUserByName( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "user/{username:regex((?!^login$)(^.+$))}")] HttpRequestData req, string username) { diff --git a/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/PetHttpTrigger.cs b/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/PetHttpTrigger.cs index a0635858..d1d1b633 100644 --- a/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/PetHttpTrigger.cs +++ b/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/PetHttpTrigger.cs @@ -35,12 +35,12 @@ public PetHttpTrigger(ILogger log, OpenApiSettings openapi, Fixt [FunctionName(nameof(PetHttpTrigger.UpdatePet))] [OpenApiOperation(operationId: "updatePet", tags: new[] { "pet" }, Summary = "Update an existing pet", Description = "This updates an existing pet.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(Pet), Required = true, Description = "Pet object that needs to be updated to the store")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "Pet details updated", Description = "Pet details updated")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Validation exception", Description = "Validation exception")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "GET", Flows = typeof(PetStoreAuth))] + [OpenApiRequestBody(verb: "GET", contentType: "application/json", bodyType: typeof(Pet), Required = true, Description = "Pet object that needs to be updated to the store")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "Pet details updated", Description = "Pet details updated")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Validation exception", Description = "Validation exception")] public async Task UpdatePet( [HttpTrigger(AuthorizationLevel.Anonymous, "PUT", Route = "pet")] HttpRequest req) { @@ -51,10 +51,10 @@ public async Task UpdatePet( [FunctionName(nameof(PetHttpTrigger.AddPet))] [OpenApiOperation(operationId: "addPet", tags: new[] { "pet" }, Summary = "Add a new pet to the store", Description = "This add a new pet to the store.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(Pet), Required = true, Description = "Pet object that needs to be added to the store")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "New pet details added", Description = "New pet details added")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Invalid input", Description = "Invalid input")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "GET", Flows = typeof(PetStoreAuth))] + [OpenApiRequestBody(verb: "GET", contentType: "application/json", bodyType: typeof(Pet), Required = true, Description = "Pet object that needs to be added to the store")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "New pet details added", Description = "New pet details added")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Invalid input", Description = "Invalid input")] public async Task AddPet( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "pet")] HttpRequest req) { @@ -65,10 +65,10 @@ public async Task AddPet( [FunctionName(nameof(PetHttpTrigger.FindByStatus))] [OpenApiOperation(operationId: "findPetsByStatus", tags: new[] { "pet" }, Summary = "Finds Pets by status", Description = "Multiple status values can be provided with comma separated strings.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiParameter(name: "status", In = ParameterLocation.Query, Required = true, Type = typeof(List), Explode = true, Summary = "Pet status value", Description = "Status values that need to be considered for filter", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid status value", Description = "Invalid status value")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "GET", Flows = typeof(PetStoreAuth))] + [OpenApiParameter(verb: "GET", name: "status", In = ParameterLocation.Query, Required = true, Type = typeof(List), Explode = true, Summary = "Pet status value", Description = "Status values that need to be considered for filter", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid status value", Description = "Invalid status value")] public async Task FindByStatus( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "pet/findByStatus")] HttpRequest req) { @@ -88,10 +88,10 @@ public async Task FindByStatus( [FunctionName(nameof(PetHttpTrigger.FindByTags))] [OpenApiOperation(operationId: "findPetsByTags", tags: new[] { "pet" }, Summary = "Finds Pets by tags", Description = "Muliple tags can be provided with comma separated strings.", Deprecated = true, Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiParameter(name: "tags", In = ParameterLocation.Query, Required = true, Type = typeof(List), Explode = true, Summary = "Tags to filter by", Description = "Tags to filter by", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid tag value", Description = "Invalid tag value")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "GET", Flows = typeof(PetStoreAuth))] + [OpenApiParameter(verb: "GET", name: "tags", In = ParameterLocation.Query, Required = true, Type = typeof(List), Explode = true, Summary = "Tags to filter by", Description = "Tags to filter by", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid tag value", Description = "Invalid tag value")] public async Task FindByTags( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "pet/findByTags")] HttpRequest req) { @@ -116,11 +116,11 @@ public async Task FindByTags( [FunctionName(nameof(PetHttpTrigger.GetPetById))] [OpenApiOperation(operationId: "getPetById", tags: new[] { "pet" }, Summary = "Find pet by ID", Description = "Returns a single pet.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("api_key", SecuritySchemeType.ApiKey, Name = "api_key", In = OpenApiSecurityLocationType.Header)] - [OpenApiParameter(name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet to return", Description = "ID of pet to return", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] + [OpenApiSecurity("api_key", SecuritySchemeType.ApiKey, "GET", Name = "api_key", In = OpenApiSecurityLocationType.Header)] + [OpenApiParameter(verb: "GET", name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet to return", Description = "ID of pet to return", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] public async Task GetPetById( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "pet/{petId}")] HttpRequest req, long petId) { @@ -133,11 +133,11 @@ public async Task GetPetById( [FunctionName(nameof(PetHttpTrigger.UpdatePetWithForm))] [OpenApiOperation(operationId: "updatePetWithForm", tags: new[] { "pet" }, Summary = "Updates a pet in the store with form data", Description = "This updates a pet in the store with form data.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiParameter(name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet that needs to be updated", Description = "ID of pet that needs to be updated", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "application/x-www-form-urlencoded", bodyType: typeof(PetUrlForm), Required = true, Description = "Pet object that needs to be added to the store")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Invalid input", Description = "Invalid input")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "GET", Flows = typeof(PetStoreAuth))] + [OpenApiParameter(verb: "GET", name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet that needs to be updated", Description = "ID of pet that needs to be updated", Visibility = OpenApiVisibilityType.Important)] + [OpenApiRequestBody(verb: "GET", contentType: "application/x-www-form-urlencoded", bodyType: typeof(PetUrlForm), Required = true, Description = "Pet object that needs to be added to the store")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Pet), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.MethodNotAllowed, Summary = "Invalid input", Description = "Invalid input")] public async Task UpdatePetWithForm( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "pet/{petId}")] HttpRequest req, long petId) { @@ -150,12 +150,12 @@ public async Task UpdatePetWithForm( [FunctionName(nameof(PetHttpTrigger.DeletePet))] [OpenApiOperation(operationId: "deletePet", tags: new[] { "pet" }, Summary = "Deletes a pet", Description = "This deletes a pet.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiParameter(name: "api_key", In = ParameterLocation.Header, Type = typeof(string), Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "Pet id to delete", Description = "Pet id to delete", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.OK, Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "GET", Flows = typeof(PetStoreAuth))] + [OpenApiParameter(verb: "GET", name: "api_key", In = ParameterLocation.Header, Type = typeof(string), Visibility = OpenApiVisibilityType.Important)] + [OpenApiParameter(verb: "GET", name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "Pet id to delete", Description = "Pet id to delete", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.OK, Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.NotFound, Summary = "Pet not found", Description = "Pet not found")] public async Task DeletePet( [HttpTrigger(AuthorizationLevel.Anonymous, "DELETE", Route = "pet/{petId}")] HttpRequest req, long petId) { @@ -166,10 +166,10 @@ public async Task DeletePet( [FunctionName(nameof(PetHttpTrigger.UploadFile))] [OpenApiOperation(operationId: "uploadFile", tags: new[] { "pet" }, Summary = "Uploads an image", Description = "This uploads an image.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, Flows = typeof(PetStoreAuth))] - [OpenApiParameter(name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet to update", Description = "ID of pet to update", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "multipart/form-data", bodyType: typeof(PetFormData))] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ApiResponse), Summary = "successful operation", Description = "successful operation")] + [OpenApiSecurity("petstore_auth", SecuritySchemeType.OAuth2, "GET", Flows = typeof(PetStoreAuth))] + [OpenApiParameter(verb: "GET", name: "petId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of pet to update", Description = "ID of pet to update", Visibility = OpenApiVisibilityType.Important)] + [OpenApiRequestBody(verb: "GET", contentType: "multipart/form-data", bodyType: typeof(PetFormData))] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ApiResponse), Summary = "successful operation", Description = "successful operation")] public async Task UploadFile( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "pet/{petId}/uploadImage")] HttpRequest req, long petId) { diff --git a/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/StoreHttpTrigger.cs b/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/StoreHttpTrigger.cs index edf063bc..d574ff7d 100644 --- a/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/StoreHttpTrigger.cs +++ b/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/StoreHttpTrigger.cs @@ -32,8 +32,8 @@ public StoreHttpTrigger(ILogger log, OpenApiSettings openapi, [FunctionName(nameof(StoreHttpTrigger.GetInventory))] [OpenApiOperation(operationId: "getInventory", tags: new[] { "store" }, Summary = "Returns pet inventories by status", Description = "This returns a map of status codes to quantities.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiSecurity("api_key", SecuritySchemeType.ApiKey, Name = "api_key", In = OpenApiSecurityLocationType.Header)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Dictionary), Description = "Successful operation")] + [OpenApiSecurity("api_key", SecuritySchemeType.ApiKey, "GET", Name = "api_key", In = OpenApiSecurityLocationType.Header)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Dictionary), Description = "Successful operation")] public async Task GetInventory( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "store/inventory")] HttpRequest req) { @@ -46,9 +46,9 @@ public async Task GetInventory( [FunctionName(nameof(StoreHttpTrigger.PlaceOrder))] [OpenApiOperation(operationId: "placeOrder", tags: new[] { "store" }, Summary = "Places an order for a pet", Description = "This places an order for a pet.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(Order), Required = true, Description = "Order placed for purchasing the pet")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Order), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid input", Description = "Invalid input")] + [OpenApiRequestBody(verb: "GET", contentType: "application/json", bodyType: typeof(Order), Required = true, Description = "Order placed for purchasing the pet")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Order), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid input", Description = "Invalid input")] public async Task PlaceOrder( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "store/order")] HttpRequest req) { @@ -59,10 +59,10 @@ public async Task PlaceOrder( [FunctionName(nameof(StoreHttpTrigger.GetOrderById))] [OpenApiOperation(operationId: "getOrderById", tags: new[] { "store" }, Summary = "Finds purchase order by ID", Description = "This finds purchase order by ID.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "orderId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of order that needs to be fetched", Description = "ID of order that needs to be fetched", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Order), Description = "Successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Order not found", Description = "Order not found")] + [OpenApiParameter(verb: "GET", name: "orderId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of order that needs to be fetched", Description = "ID of order that needs to be fetched", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Order), Description = "Successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.NotFound, Summary = "Order not found", Description = "Order not found")] public async Task GetOrderById( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "store/order/{orderId}")] HttpRequest req, long orderId) { @@ -75,9 +75,9 @@ public async Task GetOrderById( [FunctionName(nameof(StoreHttpTrigger.DeleteOrder))] [OpenApiOperation(operationId: "deleteOrder", tags: new[] { "store" }, Summary = "Deletes purchase order by ID", Description = "For valid response try integer IDs with positive integer value. Negative or non - integer values will generate API errors.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "orderId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of order that needs to be deleted", Description = "ID of order that needs to be deleted", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Order not found", Description = "Order not found")] + [OpenApiParameter(verb: "GET", name: "orderId", In = ParameterLocation.Path, Required = true, Type = typeof(long), Summary = "ID of order that needs to be deleted", Description = "ID of order that needs to be deleted", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid ID supplied", Description = "Invalid ID supplied")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.NotFound, Summary = "Order not found", Description = "Order not found")] public async Task DeleteOrder( [HttpTrigger(AuthorizationLevel.Anonymous, "DELETE", Route = "store/order/{orderId}")] HttpRequest req, long orderId) { diff --git a/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/UserHttpTrigger.cs b/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/UserHttpTrigger.cs index 3973c517..6c60ea67 100644 --- a/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/UserHttpTrigger.cs +++ b/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.InProc/UserHttpTrigger.cs @@ -34,8 +34,8 @@ public UserHttpTrigger(ILogger log, OpenApiSettings openapi, Fi [FunctionName(nameof(UserHttpTrigger.CreateUser))] [OpenApiOperation(operationId: "createUser", tags: new[] { "user" }, Summary = "Creates user", Description = "This can only be done by the logged in user.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(User), Required = true, Description = "Created user object")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(User), Summary = "successful operation", Description = "successful operation")] + [OpenApiRequestBody(verb: "GET", contentType: "application/json", bodyType: typeof(User), Required = true, Description = "Created user object")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(User), Summary = "successful operation", Description = "successful operation")] public async Task CreateUser( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "user")] HttpRequest req) { @@ -46,8 +46,8 @@ public async Task CreateUser( [FunctionName(nameof(UserHttpTrigger.CreateUsersWithArrayInput))] [OpenApiOperation(operationId: "createUsersWithArrayInput", tags: new[] { "user" }, Summary = "Creates list of users with given input array", Description = "This Creates list of users with given input array.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(List), Required = true, Description = "List of user object")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] + [OpenApiRequestBody(verb: "GET", contentType: "application/json", bodyType: typeof(List), Required = true, Description = "List of user object")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] public async Task CreateUsersWithArrayInput( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "user/createWithArray")] HttpRequest req) { @@ -58,8 +58,8 @@ public async Task CreateUsersWithArrayInput( [FunctionName(nameof(UserHttpTrigger.CreateUsersWithListInput))] [OpenApiOperation(operationId: "createUsersWithListInput", tags: new[] { "user" }, Summary = "Creates list of users with given input array", Description = "This Creates list of users with given input array.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(List), Required = true, Description = "List of user object")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] + [OpenApiRequestBody(verb: "GET", contentType: "application/json", bodyType: typeof(List), Required = true, Description = "List of user object")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "successful operation", Description = "successful operation")] public async Task CreateUsersWithListInput( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "user/createWithList")] HttpRequest req) { @@ -70,9 +70,9 @@ public async Task CreateUsersWithListInput( [FunctionName(nameof(UserHttpTrigger.LoginUser))] [OpenApiOperation(operationId: "loginUser", tags: new[] { "user" }, Summary = "Logs user into the system", Description = "This logs user into the system.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "username", In = ParameterLocation.Query, Required = true, Type = typeof(string), Summary = "The user name for login", Description = "The user name for login", Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "password", In = ParameterLocation.Query, Required = true, Type = typeof(string), Summary = "The password for login in clear text", Description = "The password for login in clear text", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), CustomHeaderType = typeof(LoginUserResponseHeader), Summary = "successful operation", Description = "successful operation")] + [OpenApiParameter(verb: "GET", name: "username", In = ParameterLocation.Query, Required = true, Type = typeof(string), Summary = "The user name for login", Description = "The user name for login", Visibility = OpenApiVisibilityType.Important)] + [OpenApiParameter(verb: "GET", name: "password", In = ParameterLocation.Query, Required = true, Type = typeof(string), Summary = "The password for login in clear text", Description = "The password for login in clear text", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), CustomHeaderType = typeof(LoginUserResponseHeader), Summary = "successful operation", Description = "successful operation")] public async Task LoginUser( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "user/login")] HttpRequest req) { @@ -93,7 +93,7 @@ public async Task LoginUser( [FunctionName(nameof(UserHttpTrigger.LogoutUser))] [OpenApiOperation(operationId: "logoutUser", tags: new[] { "user" }, Summary = "Logs out current logged in user session", Description = "This logs out current logged in user session.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.OK, Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.OK, Summary = "successful operation", Description = "successful operation")] public async Task LogoutUser( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "user/logout")] HttpRequest req) { @@ -104,10 +104,10 @@ public async Task LogoutUser( [FunctionName(nameof(UserHttpTrigger.GetUserByName))] [OpenApiOperation(operationId: "getUserByName", tags: new[] { "user" }, Summary = "Gets user by user name", Description = "This gets user by user name.", Visibility = OpenApiVisibilityType.Important)] - [OpenApiParameter(name: "username", In = ParameterLocation.Path, Required = true, Type = typeof(string), Summary = "The user name for login", Description = "The user name for login", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(User), Summary = "successful operation", Description = "successful operation")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid username supplied", Description = "Invalid username supplied")] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "User not found", Description = "User not found")] + [OpenApiParameter(verb: "GET", name: "username", In = ParameterLocation.Path, Required = true, Type = typeof(string), Summary = "The user name for login", Description = "The user name for login", Visibility = OpenApiVisibilityType.Important)] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(User), Summary = "successful operation", Description = "successful operation")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.BadRequest, Summary = "Invalid username supplied", Description = "Invalid username supplied")] + [OpenApiResponseWithoutBody(verb: "GET", statusCode: HttpStatusCode.NotFound, Summary = "User not found", Description = "User not found")] public async Task GetUserByName( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "user/{username:regex((?!^login$)(^.+$))}")] HttpRequest req, string username) { diff --git a/src/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/Document.cs b/src/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/Document.cs index 795d0b08..a5ec7b54 100644 --- a/src/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/Document.cs +++ b/src/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/Document.cs @@ -167,24 +167,27 @@ public IDocument Build(Assembly assembly, OpenApiVersionType version = OpenApiVe continue; } - var verb = this._helper.GetHttpVerb(trigger); - + var verbs = this._helper.GetHttpVerbs(trigger); var item = this._helper.GetOpenApiPath(path, paths); - var operations = item.Operations; - var operation = this._helper.GetOpenApiOperation(method, function, verb); - if (GenericExtensions.IsNullOrDefault(operation)) - { - continue; - } + foreach(var verb in verbs) { + var operations = item.Operations; - operation.Security = this._helper.GetOpenApiSecurityRequirement(method, this._strategy); - operation.Parameters = this._helper.GetOpenApiParameters(method, trigger, this._strategy, this._collection, version); - operation.RequestBody = this._helper.GetOpenApiRequestBody(method, this._strategy, this._collection, version); - operation.Responses = this._helper.GetOpenApiResponses(method, this._strategy, this._collection, version); + var operation = this._helper.GetOpenApiOperation(method, function, verb); + if (GenericExtensions.IsNullOrDefault(operation)) + { + continue; + } + + operation.Security = this._helper.GetOpenApiSecurityRequirement(method, verb.ToString(), this._strategy); + operation.Parameters = this._helper.GetOpenApiParameters(method, verb.ToString(), trigger, this._strategy, this._collection, version); + operation.RequestBody = this._helper.GetOpenApiRequestBody(method, verb.ToString(), this._strategy, this._collection, version); + operation.Responses = this._helper.GetOpenApiResponses(method, verb.ToString(), this._strategy, this._collection, version); + + operations[verb] = operation; + item.Operations = operations; + } - operations[verb] = operation; - item.Operations = operations; paths[path] = item; } diff --git a/src/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/Extensions/DocumentHelperExtensions.cs b/src/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/Extensions/DocumentHelperExtensions.cs index 3cc2f9fc..0ca79fa7 100644 --- a/src/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/Extensions/DocumentHelperExtensions.cs +++ b/src/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/Extensions/DocumentHelperExtensions.cs @@ -99,13 +99,9 @@ public static string GetHttpEndpoint(this IDocumentHelper helper, FunctionAttrib /// instance. /// instance. /// value. - public static OperationType GetHttpVerb(this IDocumentHelper helper, HttpTriggerAttribute trigger) + public static List GetHttpVerbs(this IDocumentHelper helper, HttpTriggerAttribute trigger) { - var verb = Enum.TryParse(trigger.Methods.First(), true, out OperationType ot) - ? ot - : throw new InvalidOperationException(); - - return verb; + return trigger.Methods.Select(m => Enum.TryParse(m, true, out OperationType ot) ? ot : throw new InvalidOperationException()).ToList(); } /// @@ -126,7 +122,7 @@ public static OpenApiOperation GetOpenApiOperation(this IDocumentHelper helper, var operation = new OpenApiOperation() { - OperationId = string.IsNullOrWhiteSpace(op.OperationId) ? $"{function.Name}_{verb}" : op.OperationId, + OperationId = string.IsNullOrWhiteSpace(op.OperationId) ? $"{function.Name}_{verb}" : $"{op.OperationId}_{verb}", Tags = op.Tags.Select(p => new OpenApiTag() { Name = p }).ToList(), Summary = op.Summary, Description = op.Description, @@ -153,10 +149,11 @@ public static OpenApiOperation GetOpenApiOperation(this IDocumentHelper helper, /// instance to process parameters. /// value. /// List of instance. - public static List GetOpenApiParameters(this IDocumentHelper helper, MethodInfo element, HttpTriggerAttribute trigger, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version) + public static List GetOpenApiParameters(this IDocumentHelper helper, MethodInfo element, string verb, HttpTriggerAttribute trigger, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version) { var parameters = element.GetCustomAttributes(inherit: false) .Where(p => p.Deprecated == false) + .Where(p => p.Verb == verb) .Select(p => p.ToOpenApiParameter(namingStrategy, collection, version)) .ToList(); diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Abstractions/IDocumentHelper.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Abstractions/IDocumentHelper.cs index 4aa7c00b..2b0df77f 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Abstractions/IDocumentHelper.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Abstractions/IDocumentHelper.cs @@ -29,7 +29,7 @@ public interface IDocumentHelper /// instance. /// instance to create the JSON schema from .NET Types. /// Collection of instance. - List GetOpenApiSecurityRequirement(MethodInfo element, NamingStrategy namingStrategy = null); + List GetOpenApiSecurityRequirement(MethodInfo element, string verb, NamingStrategy namingStrategy = null); /// /// Gets the instance. @@ -39,7 +39,7 @@ public interface IDocumentHelper /// instance to process parameters. /// OpenAPI spec version. /// instance. - OpenApiRequestBody GetOpenApiRequestBody(MethodInfo element, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version = OpenApiVersionType.V2); + OpenApiRequestBody GetOpenApiRequestBody(MethodInfo element, string verb, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version = OpenApiVersionType.V2); /// /// Gets the instance. @@ -48,7 +48,7 @@ public interface IDocumentHelper /// instance to create the JSON schema from .NET Types. /// instance. [Obsolete("This method is obsolete from 2.0.0. Use GetOpenApiResponses instead", error: true)] - OpenApiResponses GetOpenApiResponseBody(MethodInfo element, NamingStrategy namingStrategy = null); + OpenApiResponses GetOpenApiResponseBody(MethodInfo element, string verb, NamingStrategy namingStrategy = null); /// /// Gets the instance. @@ -58,7 +58,7 @@ public interface IDocumentHelper /// instance to process parameters. /// OpenAPI spec version. /// instance. - OpenApiResponses GetOpenApiResponses(MethodInfo element, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version = OpenApiVersionType.V2); + OpenApiResponses GetOpenApiResponses(MethodInfo element,string verb, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version = OpenApiVersionType.V2); /// /// Gets the collection of instances. diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiParameterAttribute.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiParameterAttribute.cs index 3deb0019..2191ebfe 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiParameterAttribute.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiParameterAttribute.cs @@ -16,11 +16,14 @@ public class OpenApiParameterAttribute : Attribute /// Initializes a new instance of the class. /// /// - public OpenApiParameterAttribute(string name) + public OpenApiParameterAttribute(string name, string verb) { this.Name = name ?? throw new ArgumentNullException(nameof(name)); + this.Verb = verb; } + public virtual string Verb {get;} + /// /// Gets the parameter name. /// diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiRequestBodyAttribute.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiRequestBodyAttribute.cs index aeeeaf3f..892c215c 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiRequestBodyAttribute.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiRequestBodyAttribute.cs @@ -13,11 +13,14 @@ public class OpenApiRequestBodyAttribute : OpenApiPayloadAttribute /// /// Content type. /// Type of payload. - public OpenApiRequestBodyAttribute(string contentType, Type bodyType) + public OpenApiRequestBodyAttribute(string contentType, Type bodyType, string verb) : base(contentType, bodyType) { + this.Verb = verb; } + public virtual string Verb {get;} + /// /// Gets or sets the value indicating whether the request body is required or not. /// diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithBodyAttribute.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithBodyAttribute.cs index 0210f050..a77b5dee 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithBodyAttribute.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithBodyAttribute.cs @@ -16,12 +16,15 @@ public class OpenApiResponseWithBodyAttribute : OpenApiPayloadAttribute /// HTTP status code. /// Content type. /// Type of payload. - public OpenApiResponseWithBodyAttribute(HttpStatusCode statusCode, string contentType, Type bodyType) + public OpenApiResponseWithBodyAttribute(HttpStatusCode statusCode, string contentType, Type bodyType, string verb) : base(contentType, bodyType) { this.StatusCode = statusCode; + this.Verb = verb; } + public virtual string Verb {get;} + /// /// Gets the HTTP status code value. /// diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithoutBodyAttribute.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithoutBodyAttribute.cs index 49bb83dc..eda7f4dc 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithoutBodyAttribute.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithoutBodyAttribute.cs @@ -13,11 +13,14 @@ public class OpenApiResponseWithoutBodyAttribute : Attribute /// Initializes a new instance of the class. /// /// HTTP status code. - public OpenApiResponseWithoutBodyAttribute(HttpStatusCode statusCode) + public OpenApiResponseWithoutBodyAttribute(HttpStatusCode statusCode, string verb) { this.StatusCode = statusCode; + this.Verb = verb; } + public virtual string Verb {get;} + /// /// Gets the HTTP status code value. /// diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiSecurityAttribute.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiSecurityAttribute.cs index 03145ca4..cb91b6c5 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiSecurityAttribute.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiSecurityAttribute.cs @@ -17,12 +17,15 @@ public class OpenApiSecurityAttribute : Attribute /// /// OpenAPI security scheme name. /// OpenAPI security scheme type. - public OpenApiSecurityAttribute(string schemeName, SecuritySchemeType schemeType) + public OpenApiSecurityAttribute(string schemeName, SecuritySchemeType schemeType, string verb) { this.SchemeName = schemeName ?? throw new ArgumentNullException(nameof(schemeName)); this.SchemeType = schemeType; + this.Verb = verb; } + public virtual string Verb {get;} + /// /// Gets the OpenAPI security scheme name. /// diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/DocumentHelper.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/DocumentHelper.cs index 70fb2f7a..64308adb 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/DocumentHelper.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/DocumentHelper.cs @@ -43,9 +43,11 @@ public OpenApiPathItem GetOpenApiPath(string path, OpenApiPaths paths) } /// - public List GetOpenApiSecurityRequirement(MethodInfo element, NamingStrategy namingStrategy = null) + public List GetOpenApiSecurityRequirement(MethodInfo element, string verb, NamingStrategy namingStrategy = null) { - var attributes = element.GetCustomAttributes(inherit: false); + var attributes = element.GetCustomAttributes(inherit: false) + .Where(oasa => oasa.Verb == verb); + if (!attributes.Any()) { return new List(); @@ -79,9 +81,10 @@ public List GetOpenApiSecurityRequirement(MethodInfo } /// - public OpenApiRequestBody GetOpenApiRequestBody(MethodInfo element, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version = OpenApiVersionType.V2) + public OpenApiRequestBody GetOpenApiRequestBody(MethodInfo element, string verb, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version = OpenApiVersionType.V2) { - var attributes = element.GetCustomAttributes(inherit: false); + var attributes = element.GetCustomAttributes(inherit: false) + .Where(p => p.Verb == verb); if (!attributes.Any()) { return null; @@ -105,23 +108,25 @@ public OpenApiRequestBody GetOpenApiRequestBody(MethodInfo element, NamingStrate /// [Obsolete("This method is obsolete from 2.0.0. Use GetOpenApiResponses instead", error: true)] - public OpenApiResponses GetOpenApiResponseBody(MethodInfo element, NamingStrategy namingStrategy = null) + public OpenApiResponses GetOpenApiResponseBody(MethodInfo element, string verb, NamingStrategy namingStrategy = null) { - return this.GetOpenApiResponses(element, namingStrategy, null); + return this.GetOpenApiResponses(element, verb, namingStrategy, null); } /// - public OpenApiResponses GetOpenApiResponses(MethodInfo element, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version = OpenApiVersionType.V2) + public OpenApiResponses GetOpenApiResponses(MethodInfo element, string verb, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version = OpenApiVersionType.V2) { var responsesWithBody = element.GetCustomAttributes(inherit: false) .Where(p => p.Deprecated == false) - .Select(p => new { StatusCode = p.StatusCode, Response = p.ToOpenApiResponse(namingStrategy, version: version) }); + .Where(p => p.Verb == verb) + .Select(p => new { Verb = p.Verb, StatusCode = p.StatusCode, Response = p.ToOpenApiResponse(namingStrategy, version: version) }); var responsesWithoutBody = element.GetCustomAttributes(inherit: false) - .Select(p => new { StatusCode = p.StatusCode, Response = p.ToOpenApiResponse(namingStrategy) }); + .Where(p => p.Verb == verb) + .Select(p => new { Verb = p.Verb, StatusCode = p.StatusCode, Response = p.ToOpenApiResponse(namingStrategy) }); var responses = responsesWithBody.Concat(responsesWithoutBody) - .ToDictionary(p => ((int)p.StatusCode).ToString(), p => p.Response) + .ToDictionary(p => $"{((int)p.StatusCode).ToString()}", p => p.Response) .ToOpenApiResponses(); return responses; diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/DocumentHelperExtensions.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/DocumentHelperExtensions.cs index 332c773a..726d9c7f 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/DocumentHelperExtensions.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/DocumentHelperExtensions.cs @@ -94,13 +94,9 @@ public static string GetHttpEndpoint(this IDocumentHelper helper, FunctionNameAt /// instance. /// instance. /// value. - public static OperationType GetHttpVerb(this IDocumentHelper helper, HttpTriggerAttribute trigger) + public static List GetHttpVerbs(this IDocumentHelper helper, HttpTriggerAttribute trigger) { - var verb = Enum.TryParse(trigger.Methods.First(), true, out OperationType ot) - ? ot - : throw new InvalidOperationException(); - - return verb; + return trigger.Methods.Select(m => Enum.TryParse(m, true, out OperationType ot) ? ot : throw new InvalidOperationException()).ToList(); } /// @@ -148,10 +144,11 @@ public static OpenApiOperation GetOpenApiOperation(this IDocumentHelper helper, /// instance to process parameters. /// value. /// List of instance. - public static List GetOpenApiParameters(this IDocumentHelper helper, MethodInfo element, HttpTriggerAttribute trigger, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version) + public static List GetOpenApiParameters(this IDocumentHelper helper, MethodInfo element, string verb, HttpTriggerAttribute trigger, NamingStrategy namingStrategy, VisitorCollection collection, OpenApiVersionType version) { var parameters = element.GetCustomAttributes(inherit: false) .Where(p => p.Deprecated == false) + .Where(p => p.Verb == verb) .Select(p => p.ToOpenApiParameter(namingStrategy, collection, version)) .ToList(); diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi/Document.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi/Document.cs index 3353fcc1..30117ea5 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi/Document.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi/Document.cs @@ -162,24 +162,26 @@ public IDocument Build(Assembly assembly, OpenApiVersionType version = OpenApiVe continue; } - var verb = this._helper.GetHttpVerb(trigger); - + var verbs = this._helper.GetHttpVerbs(trigger); var item = this._helper.GetOpenApiPath(path, paths); - var operations = item.Operations; - var operation = this._helper.GetOpenApiOperation(method, function, verb); - if (operation.IsNullOrDefault()) - { - continue; - } + foreach(var verb in verbs) { + var operations = item.Operations; + + var operation = this._helper.GetOpenApiOperation(method, function, verb); + if (GenericExtensions.IsNullOrDefault(operation)) + { + continue; + } - operation.Security = this._helper.GetOpenApiSecurityRequirement(method, this._strategy); - operation.Parameters = this._helper.GetOpenApiParameters(method, trigger, this._strategy, this._collection, version); - operation.RequestBody = this._helper.GetOpenApiRequestBody(method, this._strategy, this._collection, version); - operation.Responses = this._helper.GetOpenApiResponses(method, this._strategy, this._collection, version); + operation.Security = this._helper.GetOpenApiSecurityRequirement(method, verb.ToString(), this._strategy); + operation.Parameters = this._helper.GetOpenApiParameters(method, verb.ToString(), trigger, this._strategy, this._collection, version); + operation.RequestBody = this._helper.GetOpenApiRequestBody(method, verb.ToString(), this._strategy, this._collection, version); + operation.Responses = this._helper.GetOpenApiResponses(method, verb.ToString(), this._strategy, this._collection, version); - operations[verb] = operation; - item.Operations = operations; + operations[verb] = operation; + item.Operations = operations; + } paths[path] = item; } diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_ArrayObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_ArrayObject_HttpTrigger.cs index db47e2f1..5776d35e 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_ArrayObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_ArrayObject_HttpTrigger.cs @@ -15,7 +15,7 @@ public static class Get_ApplicationJson_ArrayObject_HttpTrigger { [FunctionName(nameof(Get_ApplicationJson_ArrayObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_ArrayObject_HttpTrigger.Get_ApplicationJson_ArrayObject), tags: new[] { "array" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ArrayObjectModel), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ArrayObjectModel), Description = "The OK response")] public static async Task Get_ApplicationJson_ArrayObject( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-array")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Array_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Array_HttpTrigger.cs index 1e5314d0..bf9f5a7c 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Array_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Array_HttpTrigger.cs @@ -14,10 +14,10 @@ namespace Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp { public static class Get_ApplicationJson_Array_HttpTrigger { - + [FunctionName(nameof(Get_ApplicationJson_Array_HttpTrigger.Get_ApplicationJson_StringArray))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_Array_HttpTrigger.Get_ApplicationJson_StringArray), tags: new[] { "array" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(string[]), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(string[]), Description = "The OK response")] public static async Task Get_ApplicationJson_StringArray( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-string-array")] HttpRequest req, ILogger log) @@ -29,7 +29,7 @@ public static async Task Get_ApplicationJson_StringArray( [FunctionName(nameof(Get_ApplicationJson_Array_HttpTrigger.Get_ApplicationJson_IntArray))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_Array_HttpTrigger.Get_ApplicationJson_IntArray), tags: new[] { "array" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(int[]), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(int[]), Description = "The OK response")] public static async Task Get_ApplicationJson_IntArray( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-int-array")] HttpRequest req, ILogger log) @@ -41,7 +41,7 @@ public static async Task Get_ApplicationJson_IntArray( [FunctionName(nameof(Get_ApplicationJson_Array_HttpTrigger.Get_ApplicationJson_BoolArray))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_Array_HttpTrigger.Get_ApplicationJson_BoolArray), tags: new[] { "array" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(bool[]), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(bool[]), Description = "The OK response")] public static async Task Get_ApplicationJson_BoolArray( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-bool-array")] HttpRequest req, ILogger log) @@ -53,7 +53,7 @@ public static async Task Get_ApplicationJson_BoolArray( [FunctionName(nameof(Get_ApplicationJson_Array_HttpTrigger.Get_ApplicationJson_IntList))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_Array_HttpTrigger.Get_ApplicationJson_IntList), tags: new[] { "array" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Description = "The OK response")] public static async Task Get_ApplicationJson_IntList( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-int-list")] HttpRequest req, ILogger log) @@ -63,4 +63,4 @@ public static async Task Get_ApplicationJson_IntList( return await Task.FromResult(result).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_BaseObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_BaseObject_HttpTrigger.cs index 9bb07948..d64912ea 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_BaseObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_BaseObject_HttpTrigger.cs @@ -15,7 +15,7 @@ public static class Get_ApplicationJson_BaseObject_HttpTrigger { [FunctionName(nameof(Get_ApplicationJson_BaseObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_BaseObject_HttpTrigger.Get_ApplicationJson_BaseObject), tags: new[] { "baseObject" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(BaseObjectModel), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(BaseObjectModel), Description = "The OK response")] public static async Task Get_ApplicationJson_BaseObject( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-baseobject")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_DataType_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_DataType_HttpTrigger.cs index 520bf8e7..8bd60c21 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_DataType_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_DataType_HttpTrigger.cs @@ -15,7 +15,7 @@ public static class Get_ApplicationJson_DataType_HttpTrigger { [FunctionName(nameof(Get_ApplicationJson_DataType_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_DataType_HttpTrigger.Get_ApplicationJson_DataType), tags: new[] { "dataType" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DataTypeObjectModel), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DataTypeObjectModel), Description = "The OK response")] public static async Task Get_ApplicationJson_DataType( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-datatype")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_DictionaryObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_DictionaryObject_HttpTrigger.cs index 465ba73e..0ceebdc6 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_DictionaryObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_DictionaryObject_HttpTrigger.cs @@ -14,7 +14,7 @@ public class Get_ApplicationJson_DictionaryObject_HttpTrigger { [FunctionName(nameof(Get_ApplicationJson_DictionaryObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_DictionaryObject_HttpTrigger.Get_ApplicationJson_DictionaryObject), tags: new[] { "dictionary" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DictionaryObjectModel), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DictionaryObjectModel), Description = "The OK response")] public static async Task Get_ApplicationJson_DictionaryObject( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-dictionaryobject")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Dictionary_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Dictionary_HttpTrigger.cs index a2d03773..c9087472 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Dictionary_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Dictionary_HttpTrigger.cs @@ -14,7 +14,7 @@ public class Get_ApplicationJson_Dictionary_HttpTrigger { [FunctionName(nameof(Get_ApplicationJson_Dictionary_HttpTrigger.Get_ApplicationJson_Dictionary))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_Dictionary_HttpTrigger.Get_ApplicationJson_Dictionary), tags: new[] { "dictionary" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Dictionary), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Dictionary), Description = "The OK response")] public static async Task Get_ApplicationJson_Dictionary( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-dictionary")] HttpRequest req, ILogger log) @@ -26,7 +26,7 @@ public static async Task Get_ApplicationJson_Dictionary( [FunctionName(nameof(Get_ApplicationJson_Dictionary_HttpTrigger.Get_ApplicationJson_Dictionary_IDictionary))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_Dictionary_HttpTrigger.Get_ApplicationJson_Dictionary_IDictionary), tags: new[] { "dictionary" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IDictionary), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IDictionary), Description = "The OK response")] public static async Task Get_ApplicationJson_Dictionary_IDictionary( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-dictionary-idictionary")] HttpRequest req, ILogger log) @@ -38,7 +38,7 @@ public static async Task Get_ApplicationJson_Dictionary_IDictiona [FunctionName(nameof(Get_ApplicationJson_Dictionary_HttpTrigger.Get_ApplicationJson_Dictionary_IReadOnlyDictionary))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_Dictionary_HttpTrigger.Get_ApplicationJson_Dictionary_IReadOnlyDictionary), tags: new[] { "dictionary" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IReadOnlyDictionary), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IReadOnlyDictionary), Description = "The OK response")] public static async Task Get_ApplicationJson_Dictionary_IReadOnlyDictionary( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-dictionary-ireadonlydictionary")] HttpRequest req, ILogger log) @@ -50,7 +50,7 @@ public static async Task Get_ApplicationJson_Dictionary_IReadOnly [FunctionName(nameof(Get_ApplicationJson_Dictionary_HttpTrigger.Get_ApplicationJson_Dictionary_KeyValuePair))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_Dictionary_HttpTrigger.Get_ApplicationJson_Dictionary_KeyValuePair), tags: new[] { "dictionary" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(KeyValuePair), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(KeyValuePair), Description = "The OK response")] public static async Task Get_ApplicationJson_Dictionary_KeyValuePair( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-dictionary-keyvaluepair")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Exception_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Exception_HttpTrigger.cs index fa6fc77f..a2889c88 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Exception_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_Exception_HttpTrigger.cs @@ -14,7 +14,7 @@ public class Get_ApplicationJson_Exception_HttpTrigger { [FunctionName(nameof(Get_ApplicationJson_Exception_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_Exception_HttpTrigger.Get_ApplicationJson_Exception), tags: new[] { "exception" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(StackOverflowException), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(StackOverflowException), Description = "The OK response")] public static async Task Get_ApplicationJson_Exception( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-exception")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_GenericAndRecursiveObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_GenericAndRecursiveObject_HttpTrigger.cs index 4de64294..95fa997e 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_GenericAndRecursiveObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_GenericAndRecursiveObject_HttpTrigger.cs @@ -15,7 +15,7 @@ public static class Get_ApplicationJson_GenericAndRecursiveObject_HttpTrigger { [FunctionName(nameof(Get_ApplicationJson_GenericAndRecursiveObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_GenericAndRecursiveObject_HttpTrigger.Get_ApplicationJson_GenericAndRecursiveObject), tags: new[] { "genericAndRecursive" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(GenericAndRecursiveObjectModel), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(GenericAndRecursiveObjectModel), Description = "The OK response")] public static async Task Get_ApplicationJson_GenericAndRecursiveObject( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-genericandrecursive")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_JObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_JObject_HttpTrigger.cs index 4b4d77d8..bc48851b 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_JObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_JObject_HttpTrigger.cs @@ -15,7 +15,7 @@ public static class Get_ApplicationJson_JObject_HttpTrigger { [FunctionName(nameof(Get_ApplicationJson_JObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_JObject_HttpTrigger.Get_ApplicationJson_JObject), tags: new[] { "jObject" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(JObjectModel), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(JObjectModel), Description = "The OK response")] public static async Task Get_ApplicationJson_JObject( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-jobject")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_JsonPropertyObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_JsonPropertyObject_HttpTrigger.cs index c3b93f86..c6765c48 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_JsonPropertyObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_JsonPropertyObject_HttpTrigger.cs @@ -15,7 +15,7 @@ public static class Get_ApplicationJson_JsonPropertyObject_HttpTrigger { [FunctionName(nameof(Get_ApplicationJson_JsonPropertyObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_JsonPropertyObject_HttpTrigger.Get_ApplicationJson_JsonPropertyObject), tags: new[] { "jsonproperty" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(JsonPropertyObjectModel), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(JsonPropertyObjectModel), Description = "The OK response")] public static async Task Get_ApplicationJson_JsonPropertyObject( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-jsonproperty")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_StringObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_StringObject_HttpTrigger.cs index 69a050dc..a0286466 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_StringObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_ApplicationJson_StringObject_HttpTrigger.cs @@ -15,7 +15,7 @@ public static class Get_ApplicationJson_StringObject_HttpTrigger { [FunctionName(nameof(Get_ApplicationJson_StringObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_ApplicationJson_StringObject_HttpTrigger.Get_ApplicationJson_StringObject), tags: new[] { "string" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(StringObjectModel), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(StringObjectModel), Description = "The OK response")] public static async Task Get_ApplicationJson_StringObject( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-string")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Deprecated_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Deprecated_HttpTrigger.cs index f440ed7a..83a575d6 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Deprecated_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Deprecated_HttpTrigger.cs @@ -13,7 +13,7 @@ public class Get_Deprecated_HttpTrigger { [FunctionName(nameof(Get_Deprecated_HttpTrigger.Get_TextPlain_Deprecated_True))] [OpenApiOperation(operationId: nameof(Get_Deprecated_HttpTrigger.Get_TextPlain_Deprecated_True), tags: new[] { "deprecated" }, Deprecated = true)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] public static async Task Get_TextPlain_Deprecated_True( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-deprecated-true")] HttpRequest req, ILogger log) @@ -25,7 +25,7 @@ public static async Task Get_TextPlain_Deprecated_True( [FunctionName(nameof(Get_Deprecated_HttpTrigger.Get_TextPlain_Deprecated_False))] [OpenApiOperation(operationId: nameof(Get_Deprecated_HttpTrigger.Get_TextPlain_Deprecated_False), tags: new[] { "deprecated" }, Deprecated = false)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] public static async Task Get_TextPlain_Deprecated_False( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-deprecated-false")] HttpRequest req, ILogger log) @@ -37,7 +37,7 @@ public static async Task Get_TextPlain_Deprecated_False( [FunctionName(nameof(Get_Deprecated_HttpTrigger.Get_TextPlain_Deprecated_Null))] [OpenApiOperation(operationId: nameof(Get_Deprecated_HttpTrigger.Get_TextPlain_Deprecated_Null), tags: new[] { "deprecated" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] public static async Task Get_TextPlain_Deprecated_Null( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-deprecated-null")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_DocumentFilter_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_DocumentFilter_HttpTrigger.cs index 2f596f6c..e748229a 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_DocumentFilter_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_DocumentFilter_HttpTrigger.cs @@ -14,7 +14,7 @@ public static class Get_DocumentFilter_HttpTrigger { [FunctionName(nameof(Get_DocumentFilter_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_DocumentFilter_HttpTrigger.Get_DocumentFilter), tags: new[] { "documentFilter" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] public static async Task Get_DocumentFilter( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-documentfilter")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Path_ParameterExamples_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Path_ParameterExamples_HttpTrigger.cs index 39695837..e6254db6 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Path_ParameterExamples_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Path_ParameterExamples_HttpTrigger.cs @@ -16,20 +16,20 @@ public static class Get_Path_ParameterExamples_HttpTrigger { [FunctionName(nameof(Get_Path_ParameterExamples_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_Path_ParameterExamples_HttpTrigger.Get_Path_ParameterExamples), tags: new[] { "parameterExamples" })] - [OpenApiParameter(name: "stringParameter", In = ParameterLocation.Path, Required = true, Example = typeof(StringParameterExample), Type = typeof(string), Description = "The **string** parameter")] - [OpenApiParameter(name: "int16Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Int16ParameterExample), Type = typeof(short), Description = "The **int16** parameter")] - [OpenApiParameter(name: "int32Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Int32ParameterExample), Type = typeof(int), Description = "The **int32** parameter")] - [OpenApiParameter(name: "int64Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Int64ParameterExample), Type = typeof(long), Description = "The **int64** parameter")] - [OpenApiParameter(name: "uint16Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Uint16ParameterExample), Type = typeof(ushort), Description = "The **uint16** parameter")] - [OpenApiParameter(name: "uint32Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Uint32ParameterExample), Type = typeof(uint), Description = "The **uint32** parameter")] - [OpenApiParameter(name: "uint64Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Uint64ParameterExample), Type = typeof(ulong), Description = "The **uint64** parameter")] - [OpenApiParameter(name: "singleParameter", In = ParameterLocation.Path, Required = true, Example = typeof(SingleParameterExample), Type = typeof(float), Description = "The **single** parameter")] - [OpenApiParameter(name: "doubleParameter", In = ParameterLocation.Path, Required = true, Example = typeof(DoubleParameterExample), Type = typeof(double), Description = "The **double** parameter")] - [OpenApiParameter(name: "dateTimeParameter", In = ParameterLocation.Path, Required = true, Example = typeof(DateTimeParameterExample), Type = typeof(DateTime), Description = "The **dateTime** parameter")] - [OpenApiParameter(name: "dateTimeOffsetParameter", In = ParameterLocation.Path, Required = true, Example = typeof(DateTimeOffsetParameterExample), Type = typeof(DateTimeOffset), Description = "The **dateTimeOffset** parameter")] - [OpenApiParameter(name: "booleanParameter", In = ParameterLocation.Path, Required = true, Example = typeof(BooleanParameterExample), Type = typeof(bool), Description = "The **boolean** parameter")] - [OpenApiParameter(name: "guidParameter", In = ParameterLocation.Path, Required = true, Example = typeof(GuidParameterExample), Type = typeof(Guid), Description = "The **guid** parameter")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] + [OpenApiParameter(verb: "GET",name: "stringParameter", In = ParameterLocation.Path, Required = true, Example = typeof(StringParameterExample), Type = typeof(string), Description = "The **string** parameter")] + [OpenApiParameter(verb: "GET",name: "int16Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Int16ParameterExample), Type = typeof(short), Description = "The **int16** parameter")] + [OpenApiParameter(verb: "GET",name: "int32Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Int32ParameterExample), Type = typeof(int), Description = "The **int32** parameter")] + [OpenApiParameter(verb: "GET",name: "int64Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Int64ParameterExample), Type = typeof(long), Description = "The **int64** parameter")] + [OpenApiParameter(verb: "GET",name: "uint16Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Uint16ParameterExample), Type = typeof(ushort), Description = "The **uint16** parameter")] + [OpenApiParameter(verb: "GET",name: "uint32Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Uint32ParameterExample), Type = typeof(uint), Description = "The **uint32** parameter")] + [OpenApiParameter(verb: "GET",name: "uint64Parameter", In = ParameterLocation.Path, Required = true, Example = typeof(Uint64ParameterExample), Type = typeof(ulong), Description = "The **uint64** parameter")] + [OpenApiParameter(verb: "GET",name: "singleParameter", In = ParameterLocation.Path, Required = true, Example = typeof(SingleParameterExample), Type = typeof(float), Description = "The **single** parameter")] + [OpenApiParameter(verb: "GET",name: "doubleParameter", In = ParameterLocation.Path, Required = true, Example = typeof(DoubleParameterExample), Type = typeof(double), Description = "The **double** parameter")] + [OpenApiParameter(verb: "GET",name: "dateTimeParameter", In = ParameterLocation.Path, Required = true, Example = typeof(DateTimeParameterExample), Type = typeof(DateTime), Description = "The **dateTime** parameter")] + [OpenApiParameter(verb: "GET",name: "dateTimeOffsetParameter", In = ParameterLocation.Path, Required = true, Example = typeof(DateTimeOffsetParameterExample), Type = typeof(DateTimeOffset), Description = "The **dateTimeOffset** parameter")] + [OpenApiParameter(verb: "GET",name: "booleanParameter", In = ParameterLocation.Path, Required = true, Example = typeof(BooleanParameterExample), Type = typeof(bool), Description = "The **boolean** parameter")] + [OpenApiParameter(verb: "GET",name: "guidParameter", In = ParameterLocation.Path, Required = true, Example = typeof(GuidParameterExample), Type = typeof(Guid), Description = "The **guid** parameter")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] public static async Task Get_Path_ParameterExamples( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-path-parameter-examples")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Query_ParameterExamples_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Query_ParameterExamples_HttpTrigger.cs index 76a73e3e..4198421b 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Query_ParameterExamples_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_Query_ParameterExamples_HttpTrigger.cs @@ -16,21 +16,21 @@ public static class Get_Query_ParameterExamples_HttpTrigger { [FunctionName(nameof(Get_Query_ParameterExamples_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_Query_ParameterExamples_HttpTrigger.Get_Query_ParameterExamples), tags: new[] { "parameterExamples" })] - [OpenApiParameter(name: "stringParameter", In = ParameterLocation.Query, Required = true, Example = typeof(StringParameterExample), Type = typeof(string), Description = "The **string** parameter")] - [OpenApiParameter(name: "int16Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Int16ParameterExample), Type = typeof(short), Description = "The **int16** parameter")] - [OpenApiParameter(name: "int32Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Int32ParameterExample), Type = typeof(int), Description = "The **int32** parameter")] - [OpenApiParameter(name: "int64Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Int64ParameterExample), Type = typeof(long), Description = "The **int64** parameter")] - [OpenApiParameter(name: "uint16Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Uint16ParameterExample), Type = typeof(ushort), Description = "The **uint16** parameter")] - [OpenApiParameter(name: "uint32Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Uint32ParameterExample), Type = typeof(uint), Description = "The **uint32** parameter")] - [OpenApiParameter(name: "uint64Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Uint64ParameterExample), Type = typeof(ulong), Description = "The **uint64** parameter")] - [OpenApiParameter(name: "singleParameter", In = ParameterLocation.Query, Required = true, Example = typeof(SingleParameterExample), Type = typeof(float), Description = "The **single** parameter")] - [OpenApiParameter(name: "doubleParameter", In = ParameterLocation.Query, Required = true, Example = typeof(DoubleParameterExample), Type = typeof(double), Description = "The **double** parameter")] - [OpenApiParameter(name: "dateTimeParameter", In = ParameterLocation.Query, Required = true, Example = typeof(DateTimeParameterExample), Type = typeof(DateTime), Description = "The **dateTime** parameter")] - [OpenApiParameter(name: "dateTimeOffsetParameter", In = ParameterLocation.Query, Required = true, Example = typeof(DateTimeOffsetParameterExample), Type = typeof(DateTimeOffset), Description = "The **dateTimeOffset** parameter")] - [OpenApiParameter(name: "booleanParameter", In = ParameterLocation.Query, Required = true, Example = typeof(BooleanParameterExample), Type = typeof(bool), Description = "The **boolean** parameter")] - [OpenApiParameter(name: "guidParameter", In = ParameterLocation.Query, Required = true, Example = typeof(GuidParameterExample), Type = typeof(Guid), Description = "The **guid** parameter")] - [OpenApiParameter(name: "byteArrayParameter", In = ParameterLocation.Query, Required = true, Example = typeof(ByteArrayParameterExample), Type = typeof(byte[]), Description = "The **byteArray** parameter")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] + [OpenApiParameter(verb: "GET",name: "stringParameter", In = ParameterLocation.Query, Required = true, Example = typeof(StringParameterExample), Type = typeof(string), Description = "The **string** parameter")] + [OpenApiParameter(verb: "GET",name: "int16Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Int16ParameterExample), Type = typeof(short), Description = "The **int16** parameter")] + [OpenApiParameter(verb: "GET",name: "int32Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Int32ParameterExample), Type = typeof(int), Description = "The **int32** parameter")] + [OpenApiParameter(verb: "GET",name: "int64Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Int64ParameterExample), Type = typeof(long), Description = "The **int64** parameter")] + [OpenApiParameter(verb: "GET",name: "uint16Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Uint16ParameterExample), Type = typeof(ushort), Description = "The **uint16** parameter")] + [OpenApiParameter(verb: "GET",name: "uint32Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Uint32ParameterExample), Type = typeof(uint), Description = "The **uint32** parameter")] + [OpenApiParameter(verb: "GET",name: "uint64Parameter", In = ParameterLocation.Query, Required = true, Example = typeof(Uint64ParameterExample), Type = typeof(ulong), Description = "The **uint64** parameter")] + [OpenApiParameter(verb: "GET",name: "singleParameter", In = ParameterLocation.Query, Required = true, Example = typeof(SingleParameterExample), Type = typeof(float), Description = "The **single** parameter")] + [OpenApiParameter(verb: "GET",name: "doubleParameter", In = ParameterLocation.Query, Required = true, Example = typeof(DoubleParameterExample), Type = typeof(double), Description = "The **double** parameter")] + [OpenApiParameter(verb: "GET",name: "dateTimeParameter", In = ParameterLocation.Query, Required = true, Example = typeof(DateTimeParameterExample), Type = typeof(DateTime), Description = "The **dateTime** parameter")] + [OpenApiParameter(verb: "GET",name: "dateTimeOffsetParameter", In = ParameterLocation.Query, Required = true, Example = typeof(DateTimeOffsetParameterExample), Type = typeof(DateTimeOffset), Description = "The **dateTimeOffset** parameter")] + [OpenApiParameter(verb: "GET",name: "booleanParameter", In = ParameterLocation.Query, Required = true, Example = typeof(BooleanParameterExample), Type = typeof(bool), Description = "The **boolean** parameter")] + [OpenApiParameter(verb: "GET",name: "guidParameter", In = ParameterLocation.Query, Required = true, Example = typeof(GuidParameterExample), Type = typeof(Guid), Description = "The **guid** parameter")] + [OpenApiParameter(verb: "GET",name: "byteArrayParameter", In = ParameterLocation.Query, Required = true, Example = typeof(ByteArrayParameterExample), Type = typeof(byte[]), Description = "The **byteArray** parameter")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] public static async Task Get_Query_ParameterExamples( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-query-parameter-examples")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TagFilter_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TagFilter_HttpTrigger.cs index 505e9d5b..46458555 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TagFilter_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TagFilter_HttpTrigger.cs @@ -14,7 +14,7 @@ public static class Get_TagFilter_HttpTrigger { [FunctionName(nameof(Get_TagFilter_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_TagFilter_HttpTrigger.Get_TagFilter), tags: new[] { "tagFilter" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] public static async Task Get_TagFilter( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-tagfilter")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_DateTime_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_DateTime_HttpTrigger.cs index 35248337..03e594b9 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_DateTime_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_DateTime_HttpTrigger.cs @@ -16,7 +16,7 @@ public static class Get_TextPlain_DateTime_HttpTrigger { [FunctionName(nameof(Get_TextPlain_DateTime_HttpTrigger.Get_TextPlain_DateTime))] [OpenApiOperation(operationId: nameof(Get_TextPlain_DateTime_HttpTrigger.Get_TextPlain_DateTime), tags: new[] { "datetime" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(DateTime), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(DateTime), Description = "The OK response")] public static async Task Get_TextPlain_DateTime( [HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = "get-textplain-datetime")] HttpRequest req, ILogger log) @@ -28,7 +28,7 @@ public static async Task Get_TextPlain_DateTime( [FunctionName(nameof(Get_TextPlain_DateTime_HttpTrigger.Get_TextPlain_DateTimeOffset))] [OpenApiOperation(operationId: nameof(Get_TextPlain_DateTime_HttpTrigger.Get_TextPlain_DateTimeOffset), tags: new[] { "datetime" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(DateTimeOffset), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(DateTimeOffset), Description = "The OK response")] public static async Task Get_TextPlain_DateTimeOffset( [HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = "get-textplain-datetimeoffset")] HttpRequest req, ILogger log) @@ -38,4 +38,4 @@ public static async Task Get_TextPlain_DateTimeOffset( return await Task.FromResult(result).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Guid_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Guid_HttpTrigger.cs index 995b14fd..86a0d43c 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Guid_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Guid_HttpTrigger.cs @@ -15,9 +15,9 @@ public static class Get_TextPlain_Guid_HttpTrigger { [FunctionName(nameof(Get_TextPlain_Guid_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Guid_HttpTrigger), tags: new[] { "guid" })] - [OpenApiParameter(name: "guid_path", In = ParameterLocation.Path, Required = true, Type = typeof(Guid), Description = "guid parameter_path")] - [OpenApiParameter(name: "guid_query", In = ParameterLocation.Query, Required = true, Type = typeof(Guid), Description = "guid parameter_query")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(Guid), Description = "The OK response")] + [OpenApiParameter(verb: "GET",name: "guid_path", In = ParameterLocation.Path, Required = true, Type = typeof(Guid), Description = "guid parameter_path")] + [OpenApiParameter(verb: "GET",name: "guid_query", In = ParameterLocation.Query, Required = true, Type = typeof(Guid), Description = "guid parameter_query")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(Guid), Description = "The OK response")] public static async Task Get_ApplicationJson_Object( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-guid")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Integer_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Integer_HttpTrigger.cs index 0bb7ecb0..fc150327 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Integer_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Integer_HttpTrigger.cs @@ -14,9 +14,9 @@ public class Get_TextPlain_Integer_HttpTrigger { [FunctionName(nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_Int16))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_Int16), tags: new[] { "integer" })] - [OpenApiParameter(name: "int16value", In = ParameterLocation.Path, Required = true, Type = typeof(short), Description = "The **int16** parameter")] - [OpenApiParameter(name: "int16value", In = ParameterLocation.Query, Required = true, Type = typeof(short), Description = "The **int16** parameter")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(short), Description = "The OK response")] + [OpenApiParameter(verb: "GET",name: "int16value", In = ParameterLocation.Path, Required = true, Type = typeof(short), Description = "The **int16** parameter")] + [OpenApiParameter(verb: "GET",name: "int16value", In = ParameterLocation.Query, Required = true, Type = typeof(short), Description = "The **int16** parameter")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(short), Description = "The OK response")] public static async Task Get_TextPlain_Int16( [HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = "get-textplain-int16")] HttpRequest req, ILogger log) @@ -28,9 +28,9 @@ public static async Task Get_TextPlain_Int16( [FunctionName(nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_Int32))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_Int32), tags: new[] { "integer" })] - [OpenApiParameter(name: "int32value", In = ParameterLocation.Path, Required = true, Type = typeof(int), Description = "The **int32** parameter")] - [OpenApiParameter(name: "int32value", In = ParameterLocation.Query, Required = true, Type = typeof(int), Description = "The **int32** parameter")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(int), Description = "The OK response")] + [OpenApiParameter(verb: "GET",name: "int32value", In = ParameterLocation.Path, Required = true, Type = typeof(int), Description = "The **int32** parameter")] + [OpenApiParameter(verb: "GET",name: "int32value", In = ParameterLocation.Query, Required = true, Type = typeof(int), Description = "The **int32** parameter")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(int), Description = "The OK response")] public static async Task Get_TextPlain_Int32( [HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = "get-textplain-int32")] HttpRequest req, ILogger log) @@ -42,9 +42,9 @@ public static async Task Get_TextPlain_Int32( [FunctionName(nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_Int64))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_Int64), tags: new[] { "integer" })] - [OpenApiParameter(name: "int64value", In = ParameterLocation.Path, Required = true, Type = typeof(long), Description = "The **int64** parameter")] - [OpenApiParameter(name: "int64value", In = ParameterLocation.Query, Required = true, Type = typeof(long), Description = "The **int64** parameter")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(long), Description = "The OK response")] + [OpenApiParameter(verb: "GET",name: "int64value", In = ParameterLocation.Path, Required = true, Type = typeof(long), Description = "The **int64** parameter")] + [OpenApiParameter(verb: "GET",name: "int64value", In = ParameterLocation.Query, Required = true, Type = typeof(long), Description = "The **int64** parameter")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(long), Description = "The OK response")] public static async Task Get_TextPlain_Int64( [HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = "get-textplain-int64")] HttpRequest req, ILogger log) @@ -56,9 +56,9 @@ public static async Task Get_TextPlain_Int64( [FunctionName(nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_UInt16))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_UInt16), tags: new[] { "integer" })] - [OpenApiParameter(name: "uint16value", In = ParameterLocation.Path, Required = true, Type = typeof(short), Description = "The **uint16** parameter")] - [OpenApiParameter(name: "uint16value", In = ParameterLocation.Query, Required = true, Type = typeof(short), Description = "The **uint16** parameter")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(ushort), Description = "The OK response")] + [OpenApiParameter(verb: "GET",name: "uint16value", In = ParameterLocation.Path, Required = true, Type = typeof(short), Description = "The **uint16** parameter")] + [OpenApiParameter(verb: "GET",name: "uint16value", In = ParameterLocation.Query, Required = true, Type = typeof(short), Description = "The **uint16** parameter")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(ushort), Description = "The OK response")] public static async Task Get_TextPlain_UInt16( [HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = "get-textplain-uint16")] HttpRequest req, ILogger log) @@ -71,9 +71,9 @@ public static async Task Get_TextPlain_UInt16( [FunctionName(nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_UInt32))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_UInt32), tags: new[] { "integer" })] - [OpenApiParameter(name: "uint32value", In = ParameterLocation.Path, Required = true, Type = typeof(uint), Description = "The **uint32** parameter")] - [OpenApiParameter(name: "uint32value", In = ParameterLocation.Query, Required = true, Type = typeof(uint), Description = "The **uint32** parameter")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(uint), Description = "The OK response")] + [OpenApiParameter(verb: "GET",name: "uint32value", In = ParameterLocation.Path, Required = true, Type = typeof(uint), Description = "The **uint32** parameter")] + [OpenApiParameter(verb: "GET",name: "uint32value", In = ParameterLocation.Query, Required = true, Type = typeof(uint), Description = "The **uint32** parameter")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(uint), Description = "The OK response")] public static async Task Get_TextPlain_UInt32( [HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = "get-textplain-uint32")] HttpRequest req, ILogger log) @@ -86,9 +86,9 @@ public static async Task Get_TextPlain_UInt32( [FunctionName(nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_UInt64))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Integer_HttpTrigger.Get_TextPlain_UInt64), tags: new[] { "integer" })] - [OpenApiParameter(name: "uint64value", In = ParameterLocation.Path, Required = true, Type = typeof(ulong), Description = "The **uint64** parameter")] - [OpenApiParameter(name: "uint64value", In = ParameterLocation.Query, Required = true, Type = typeof(ulong), Description = "The **uint64** parameter")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(ulong), Description = "The OK response")] + [OpenApiParameter(verb: "GET",name: "uint64value", In = ParameterLocation.Path, Required = true, Type = typeof(ulong), Description = "The **uint64** parameter")] + [OpenApiParameter(verb: "GET",name: "uint64value", In = ParameterLocation.Query, Required = true, Type = typeof(ulong), Description = "The **uint64** parameter")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(ulong), Description = "The OK response")] public static async Task Get_TextPlain_UInt64( [HttpTrigger(AuthorizationLevel.Anonymous, "Get", Route = "get-textplain-uint64")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Nullable_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Nullable_HttpTrigger.cs index 1c07564e..404fc978 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Nullable_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Nullable_HttpTrigger.cs @@ -15,7 +15,7 @@ public static class Get_TextPlain_Nullable_HttpTrigger { [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableBoolean))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableBoolean), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(bool?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(bool?), Description = "The OK response")] public static async Task Get_TextPlain_NullableBoolean( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullableboolean")] HttpRequest req, ILogger log) @@ -27,7 +27,7 @@ public static async Task Get_TextPlain_NullableBoolean( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableUInt16))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableUInt16), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(ushort?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(ushort?), Description = "The OK response")] public static async Task Get_TextPlain_NullableUInt16( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullableuint16")] HttpRequest req, ILogger log) @@ -39,7 +39,7 @@ public static async Task Get_TextPlain_NullableUInt16( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableUInt32))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableUInt32), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(uint?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(uint?), Description = "The OK response")] public static async Task Get_TextPlain_NullableUInt32( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullableuint32")] HttpRequest req, ILogger log) @@ -51,7 +51,7 @@ public static async Task Get_TextPlain_NullableUInt32( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableUInt64))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableUInt64), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(ulong?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(ulong?), Description = "The OK response")] public static async Task Get_TextPlain_NullableUInt64( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullableuint64")] HttpRequest req, ILogger log) @@ -63,7 +63,7 @@ public static async Task Get_TextPlain_NullableUInt64( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableInt16))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableInt16), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(short?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(short?), Description = "The OK response")] public static async Task Get_TextPlain_NullableInt16( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullableint16")] HttpRequest req, ILogger log) @@ -75,7 +75,7 @@ public static async Task Get_TextPlain_NullableInt16( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableInt32))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableInt32), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(int?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(int?), Description = "The OK response")] public static async Task Get_TextPlain_NullableInt32( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullableint32")] HttpRequest req, ILogger log) @@ -87,7 +87,7 @@ public static async Task Get_TextPlain_NullableInt32( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableInt64))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableInt64), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(long?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(long?), Description = "The OK response")] public static async Task Get_TextPlain_NullableInt64( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullableint64")] HttpRequest req, ILogger log) @@ -99,7 +99,7 @@ public static async Task Get_TextPlain_NullableInt64( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableSingle))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableSingle), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(float?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(float?), Description = "The OK response")] public static async Task Get_TextPlain_NullableSingle( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullablesingle")] HttpRequest req, ILogger log) @@ -111,7 +111,7 @@ public static async Task Get_TextPlain_NullableSingle( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableDouble))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableDouble), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(double?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(double?), Description = "The OK response")] public static async Task Get_TextPlain_NullableDouble( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullabledouble")] HttpRequest req, ILogger log) @@ -123,7 +123,7 @@ public static async Task Get_TextPlain_NullableDouble( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableDecimal))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableDecimal), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(decimal?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(decimal?), Description = "The OK response")] public static async Task Get_TextPlain_NullableDecimal( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullabledecimal")] HttpRequest req, ILogger log) @@ -135,7 +135,7 @@ public static async Task Get_TextPlain_NullableDecimal( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableDateTime))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableDateTime), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(DateTime?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(DateTime?), Description = "The OK response")] public static async Task Get_TextPlain_NullableDateTime( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullabledatetime")] HttpRequest req, ILogger log) @@ -147,7 +147,7 @@ public static async Task Get_TextPlain_NullableDateTime( [FunctionName(nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableDateTimeOffset))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Nullable_HttpTrigger.Get_TextPlain_NullableDateTimeOffset), tags: new[] { "nullable" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(DateTimeOffset?), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(DateTimeOffset?), Description = "The OK response")] public static async Task Get_TextPlain_NullableDateTimeOffset( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-nullabledatetimeoffset")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_String_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_String_HttpTrigger.cs index be993a4e..4f7b020e 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_String_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_String_HttpTrigger.cs @@ -14,7 +14,7 @@ public static class Get_TextPlain_String_HttpTrigger { [FunctionName(nameof(Get_TextPlain_String_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_TextPlain_String_HttpTrigger.Get_TextPlain_String), tags: new[] { "string" })] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] public static async Task Get_TextPlain_String( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-textplain-string")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Uri_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Uri_HttpTrigger.cs index 5ca841b6..db49b19f 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Uri_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Get_TextPlain_Uri_HttpTrigger.cs @@ -15,8 +15,8 @@ public static class Get_TextPlain_Uri_HttpTrigger { [FunctionName(nameof(Get_TextPlain_Uri_HttpTrigger))] [OpenApiOperation(operationId: nameof(Get_TextPlain_Uri_HttpTrigger.Get_TextPlain_Uri), tags: new[] { "uri" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(Uri), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(Uri), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(Uri), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(Uri), Description = "The OK response")] public static async Task Get_TextPlain_Uri( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "get-applicationjson-uri")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_BooleanObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_BooleanObject_HttpTrigger.cs index 26968121..69ab7f5a 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_BooleanObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_BooleanObject_HttpTrigger.cs @@ -15,8 +15,8 @@ public static class Post_ApplicationJson_BooleanObject_HttpTrigger { [FunctionName(nameof(Post_ApplicationJson_BooleanObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_BooleanObject_HttpTrigger.Post_ApplicationJson_BooleanObject), tags: new[] { "boolean" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(bool), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(BooleanObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(bool), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(BooleanObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_BooleanObject( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-boolean")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_ByteArrayObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_ByteArrayObject_HttpTrigger.cs index a930af31..2e1d2eff 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_ByteArrayObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_ByteArrayObject_HttpTrigger.cs @@ -15,8 +15,8 @@ public static class Post_ApplicationJson_ByteArrayObject_HttpTrigger { [FunctionName(nameof(Post_ApplicationJson_ByteArrayObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_ByteArrayObject_HttpTrigger.Post_ApplicationJson_ByteArrayObject), tags: new[] { "bytearray" })] - [OpenApiRequestBody(contentType: "application/octet-stream", bodyType: typeof(byte[]), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ByteArrayObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "application/octet-stream", bodyType: typeof(byte[]), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ByteArrayObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_ByteArrayObject( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-bytearray")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_DateTime_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_DateTime_HttpTrigger.cs index 50c7ddd8..be9caaa0 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_DateTime_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_DateTime_HttpTrigger.cs @@ -16,8 +16,8 @@ public static class Post_ApplicationJson_DateTime_HttpTrigger { [FunctionName(nameof(Post_ApplicationJson_DateTime_HttpTrigger.Post_ApplicationJson_DateTime))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_DateTime_HttpTrigger.Post_ApplicationJson_DateTime), tags: new[] { "datetime" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(DateTime), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DateTimeObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(DateTime), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DateTimeObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_DateTime( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-datetime")] HttpRequest req, ILogger log) @@ -29,8 +29,8 @@ public static async Task Post_ApplicationJson_DateTime( [FunctionName(nameof(Post_ApplicationJson_DateTime_HttpTrigger.Post_ApplicationJson_DateTimeOffset))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_DateTime_HttpTrigger.Post_ApplicationJson_DateTimeOffset), tags: new[] { "datetime" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(DateTimeOffset), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DateTimeObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(DateTimeOffset), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DateTimeObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_DateTimeOffset( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-datetimeoffset")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_ExceptionObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_ExceptionObject_HttpTrigger.cs index 54e4644e..14adab77 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_ExceptionObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_ExceptionObject_HttpTrigger.cs @@ -15,8 +15,8 @@ public class Post_ApplicationJson_ExceptionObject_HttpTrigger { [FunctionName(nameof(Post_ApplicationJson_ExceptionObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_ExceptionObject_HttpTrigger.Post_ApplicationJson_ExceptionObject), tags: new[] { "exception" })] - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(InvalidOperationException), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ExceptionObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "application/json", bodyType: typeof(InvalidOperationException), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(ExceptionObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_ExceptionObject( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-exception")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_GuidObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_GuidObject_HttpTrigger.cs index 4e446c77..dfdfb59b 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_GuidObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_GuidObject_HttpTrigger.cs @@ -16,8 +16,8 @@ public static class Post_ApplicationJson_GuidObject_HttpTrigger { [FunctionName(nameof(Post_ApplicationJson_GuidObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_GuidObject_HttpTrigger), tags: new[] { "guid" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(Guid), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(GuidObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(Guid), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(GuidObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_GuidObject( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-guid")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_IntegerObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_IntegerObject_HttpTrigger.cs index d9d8c4a0..736b1c01 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_IntegerObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_IntegerObject_HttpTrigger.cs @@ -15,8 +15,8 @@ public class Post_ApplicationJson_IntegerObject_HttpTrigger { [FunctionName(nameof(Post_ApplicationJson_Int16Object))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_IntegerObject_HttpTrigger.Post_ApplicationJson_Int16Object), tags: new[] { "integer" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(short), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(short), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_Int16Object( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-int16")] HttpRequest req, ILogger log) @@ -28,8 +28,8 @@ public static async Task Post_ApplicationJson_Int16Object( [FunctionName(nameof(Post_ApplicationJson_Int32Object))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_IntegerObject_HttpTrigger.Post_ApplicationJson_Int32Object), tags: new[] { "integer" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(int), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(int), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_Int32Object( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-int32")] HttpRequest req, ILogger log) @@ -41,8 +41,8 @@ public static async Task Post_ApplicationJson_Int32Object( [FunctionName(nameof(Post_ApplicationJson_Int64Object))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_IntegerObject_HttpTrigger.Post_ApplicationJson_Int64Object), tags: new[] { "integer" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(long), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(long), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_Int64Object( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-int64")] HttpRequest req, ILogger log) @@ -54,8 +54,8 @@ public static async Task Post_ApplicationJson_Int64Object( [FunctionName(nameof(Post_ApplicationJson_UInt16Object))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_IntegerObject_HttpTrigger.Post_ApplicationJson_UInt16Object), tags: new[] { "integer" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(ushort), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(ushort), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_UInt16Object( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-uint16")] HttpRequest req, ILogger log) @@ -67,8 +67,8 @@ public static async Task Post_ApplicationJson_UInt16Object( [FunctionName(nameof(Post_ApplicationJson_UInt32Object))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_IntegerObject_HttpTrigger.Post_ApplicationJson_UInt32Object), tags: new[] { "integer" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(uint), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(uint), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_UInt32Object( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-uint32")] HttpRequest req, ILogger log) @@ -80,8 +80,8 @@ public static async Task Post_ApplicationJson_UInt32Object( [FunctionName(nameof(Post_ApplicationJson_UInt64Object))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_IntegerObject_HttpTrigger.Post_ApplicationJson_UInt64Object), tags: new[] { "integer" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(ulong), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(ulong), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(IntegerObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_UInt64Object( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-uint64")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_NullableObject_HttpTrigger copy.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_NullableObject_HttpTrigger copy.cs index 89adf504..e1c24a52 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_NullableObject_HttpTrigger copy.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_NullableObject_HttpTrigger copy.cs @@ -16,8 +16,8 @@ public static class Post_ApplicationJson_NullableObject_HttpTrigger { [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableBoolean))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableBoolean), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(bool?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(bool?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableBoolean( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullableboolean")] HttpRequest req, ILogger log) @@ -29,8 +29,8 @@ public static async Task Post_ApplicationJson_NullableBoolean( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableUInt16))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableUInt16), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(ushort?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(ushort?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableUInt16( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullableuint16")] HttpRequest req, ILogger log) @@ -42,8 +42,8 @@ public static async Task Post_ApplicationJson_NullableUInt16( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableUInt32))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableUInt32), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(uint?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(uint?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableUInt32( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullableuint32")] HttpRequest req, ILogger log) @@ -55,8 +55,8 @@ public static async Task Post_ApplicationJson_NullableUInt32( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableUInt64))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableUInt64), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(ulong?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(ulong?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableUInt64( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullableuint64")] HttpRequest req, ILogger log) @@ -68,8 +68,8 @@ public static async Task Post_ApplicationJson_NullableUInt64( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableInt16))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableInt16), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(short?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(short?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableInt16( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullableint16")] HttpRequest req, ILogger log) @@ -81,8 +81,8 @@ public static async Task Post_ApplicationJson_NullableInt16( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableInt32))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableInt32), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(int?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(int?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableInt32( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullableint32")] HttpRequest req, ILogger log) @@ -94,8 +94,8 @@ public static async Task Post_ApplicationJson_NullableInt32( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableInt64))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableInt64), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(long?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(long?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableInt64( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullableint64")] HttpRequest req, ILogger log) @@ -107,8 +107,8 @@ public static async Task Post_ApplicationJson_NullableInt64( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableSingle))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableSingle), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(float?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(float?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableSingle( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullablesingle")] HttpRequest req, ILogger log) @@ -120,8 +120,8 @@ public static async Task Post_ApplicationJson_NullableSingle( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableDouble))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableDouble), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(double?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(double?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableDouble( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullabledouble")] HttpRequest req, ILogger log) @@ -133,8 +133,8 @@ public static async Task Post_ApplicationJson_NullableDouble( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableDecimal))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableDecimal), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(decimal?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(decimal?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableDecimal( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullabledecimal")] HttpRequest req, ILogger log) @@ -146,8 +146,8 @@ public static async Task Post_ApplicationJson_NullableDecimal( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableDateTime))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableDateTime), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(DateTime?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(DateTime?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableDateTime( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullabledatetime")] HttpRequest req, ILogger log) @@ -159,8 +159,8 @@ public static async Task Post_ApplicationJson_NullableDateTime( [FunctionName(nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableDateTimeOffset))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NullableObject_HttpTrigger.Post_ApplicationJson_NullableDateTimeOffset), tags: new[] { "nullable" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(DateTimeOffset?), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(DateTimeOffset?), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NullableObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_NullableDateTimeOffset( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-nullabledatetimeoffset")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_NumberObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_NumberObject_HttpTrigger.cs index f8a9cc12..962a3b15 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_NumberObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_NumberObject_HttpTrigger.cs @@ -15,8 +15,8 @@ public static class Post_ApplicationJson_NumberObject_HttpTrigger { [FunctionName(nameof(Post_ApplicationJson_SingleObject))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NumberObject_HttpTrigger.Post_ApplicationJson_SingleObject), tags: new[] { "number" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(float), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NumberObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(float), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NumberObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_SingleObject( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-single")] HttpRequest req, ILogger log) @@ -28,8 +28,8 @@ public static async Task Post_ApplicationJson_SingleObject( [FunctionName(nameof(Post_ApplicationJson_DoubleObject))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NumberObject_HttpTrigger.Post_ApplicationJson_DoubleObject), tags: new[] { "number" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(double), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NumberObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(double), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NumberObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_DoubleObject( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-double")] HttpRequest req, ILogger log) @@ -41,8 +41,8 @@ public static async Task Post_ApplicationJson_DoubleObject( [FunctionName(nameof(Post_ApplicationJson_DecimalObject))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_NumberObject_HttpTrigger.Post_ApplicationJson_DecimalObject), tags: new[] { "number" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(decimal), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NumberObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET",contentType: "text/plain", bodyType: typeof(decimal), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET",statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(NumberObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_DecimalObject( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-decimal")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_StringObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_StringObject_HttpTrigger.cs index 8631cfbb..fd8099d2 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_StringObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_StringObject_HttpTrigger.cs @@ -15,8 +15,8 @@ public static class Post_ApplicationJson_StringObject_HttpTrigger { [FunctionName(nameof(Post_ApplicationJson_StringObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_StringObject_HttpTrigger.Post_ApplicationJson_StringObject), tags: new[] { "string" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(string), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(StringObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET", contentType: "text/plain", bodyType: typeof(string), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(StringObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_StringObject( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-string")] HttpRequest req, ILogger log) diff --git a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_UriObject_HttpTrigger.cs b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_UriObject_HttpTrigger.cs index 68fa49fc..42792f01 100644 --- a/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_UriObject_HttpTrigger.cs +++ b/test-integration/Microsoft.Azure.WebJobs.Extensions.OpenApi.TestApp/Post_ApplicationJson_UriObject_HttpTrigger.cs @@ -16,8 +16,8 @@ public static class Post_ApplicationJson_UriObject_HttpTrigger { [FunctionName(nameof(Post_ApplicationJson_UriObject_HttpTrigger))] [OpenApiOperation(operationId: nameof(Post_ApplicationJson_UriObject_HttpTrigger.Post_ApplicationJson_UriObject), tags: new[] { "uri" })] - [OpenApiRequestBody(contentType: "text/plain", bodyType: typeof(Uri), Required = true, Description = "The OK response")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(UriObjectModel), Description = "The OK response")] + [OpenApiRequestBody(verb: "GET", contentType: "text/plain", bodyType: typeof(Uri), Required = true, Description = "The OK response")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(UriObjectModel), Description = "The OK response")] public static async Task Post_ApplicationJson_UriObject( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "post-applicationjson-uri")] HttpRequest req, ILogger log) diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctions.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctions.cs index 0fa131d1..7858cc14 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctions.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctions.cs @@ -8,30 +8,30 @@ namespace Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes { public static class FakeFunctions { - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "List of the fake responses", Description = "This returns the list of fake responses", CustomHeaderType = typeof(FakeResponseHeader))] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "List of the fake responses", Description = "This returns the list of fake responses", CustomHeaderType = typeof(FakeResponseHeader))] public static void GetFakes() { } - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(FakeClassModel), Required = true, Description = "Fake request model")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeClassModel), Summary = "Fake response", Description = "This returns the fake response", CustomHeaderType = typeof(FakeResponseHeader))] + [OpenApiRequestBody(verb: "GET", contentType: "application/json", bodyType: typeof(FakeClassModel), Required = true, Description = "Fake request model")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeClassModel), Summary = "Fake response", Description = "This returns the fake response", CustomHeaderType = typeof(FakeResponseHeader))] public static void AddFakes() { } - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(FakeListModel), Required = true, Description = "Fake list model")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "Fake response", Description = "This returns the fake response", CustomHeaderType = typeof(FakeResponseHeader))] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeStringModel), Summary = "Fake response", Description = "This returns the fake response", Deprecated = true, CustomHeaderType = typeof(FakeResponseHeader))] + [OpenApiRequestBody(verb: "GET", contentType: "application/json", bodyType: typeof(FakeListModel), Required = true, Description = "Fake list model")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "Fake response", Description = "This returns the fake response", CustomHeaderType = typeof(FakeResponseHeader))] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeStringModel), Summary = "Fake response", Description = "This returns the fake response", Deprecated = true, CustomHeaderType = typeof(FakeResponseHeader))] public static void UpdateFakes() { } - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(FakeGenericModel), Required = true, Description = "Fake list model")] + [OpenApiRequestBody(verb: "GET", contentType: "application/json", bodyType: typeof(FakeGenericModel), Required = true, Description = "Fake list model")] public static void GenericMethodOne() { } - [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(FakeGenericModel), Required = true, Description = "Fake list model")] + [OpenApiRequestBody(verb: "GET", contentType: "application/json", bodyType: typeof(FakeGenericModel), Required = true, Description = "Fake list model")] public static void GenericMethodTwo() { } diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctionsWithOverlappingModel.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctionsWithOverlappingModel.cs index 79e54c90..bd9034e8 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctionsWithOverlappingModel.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctionsWithOverlappingModel.cs @@ -12,8 +12,8 @@ public class FakeInternalModel } [OpenApiOperation("test-function")] - [OpenApiRequestBody("application/json", typeof(FakeInternalModel))] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeInternalModel), Summary = "Logs Retrieved.", Description = "Returns the logs matching search parameters.")] + [OpenApiRequestBody("application/json", typeof(FakeInternalModel), "GET")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeInternalModel), Summary = "Logs Retrieved.", Description = "Returns the logs matching search parameters.")] public void Run() { } @@ -26,8 +26,8 @@ public class FakeInternalModel } [OpenApiOperation("test-function")] - [OpenApiRequestBody("application/json", typeof(FakeInternalModel))] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeInternalModel), Summary = "Logs Retrieved.", Description = "Returns the logs matching search parameters.")] + [OpenApiRequestBody("application/json", typeof(FakeInternalModel), "GET")] + [OpenApiResponseWithBody(verb: "GET", statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeInternalModel), Summary = "Logs Retrieved.", Description = "Returns the logs matching search parameters.")] public void Run() { } diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiParameterAttributeTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiParameterAttributeTests.cs index b63e4e86..dc39c8d9 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiParameterAttributeTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiParameterAttributeTests.cs @@ -16,7 +16,7 @@ public class OpenApiParameterAttributeTests [TestMethod] public void Given_Null_When_Instantiated_It_Should_Throw_Exception() { - Action action = () => new OpenApiParameterAttribute(null); + Action action = () => new OpenApiParameterAttribute(null, "GET"); action.Should().Throw(); } @@ -25,7 +25,7 @@ public void Given_Null_When_Instantiated_It_Should_Throw_Exception() [DataRow("Hello World")] public void Given_Parameter_When_Instantiated_It_Should_Return_Value(string name) { - var attribute = new OpenApiParameterAttribute(name); + var attribute = new OpenApiParameterAttribute(name, "GET"); attribute.Name.Should().BeEquivalentTo(name); attribute.Summary.Should().BeNullOrWhiteSpace(); @@ -45,7 +45,7 @@ public void Given_Properties_When_Instantiated_It_Should_Return_Value( string summary, string description, Type type, ParameterLocation @in, OpenApiParameterCollectionDelimiterType delimiter, bool explode, bool required, OpenApiVisibilityType visibility, bool deprecated) { - var attribute = new OpenApiParameterAttribute("Name") + var attribute = new OpenApiParameterAttribute("Name", "GET") { Summary = summary, Description = description, diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiRequestBodyAttributeTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiRequestBodyAttributeTests.cs index 2d568631..c2120507 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiRequestBodyAttributeTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiRequestBodyAttributeTests.cs @@ -14,10 +14,10 @@ public class OpenApiRequestBodyAttributeTests [TestMethod] public void Given_Null_When_Instantiated_Then_It_Should_Throw_Exception() { - Action action = () => new OpenApiRequestBodyAttribute(null, null); + Action action = () => new OpenApiRequestBodyAttribute(null, null, "GET"); action.Should().Throw(); - action = () => new OpenApiRequestBodyAttribute("hello world", null); + action = () => new OpenApiRequestBodyAttribute("hello world", null, "GET"); action.Should().Throw(); } @@ -25,7 +25,7 @@ public void Given_Null_When_Instantiated_Then_It_Should_Throw_Exception() [DataRow("Hello World", typeof(object))] public void Given_Parameters_When_Instantiated_It_Should_Return_Value(string contentType, Type bodyType) { - var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType); + var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType, "GET"); attribute.ContentType.Should().BeEquivalentTo(contentType); attribute.BodyType.Should().Be(bodyType); @@ -40,7 +40,7 @@ public void Given_Properties_When_Instantiated_It_Should_Return_Value(string des { var contentType = "Hello World"; var bodyType = typeof(object); - var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType) + var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType, "GET") { Description = description, Required = required, diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithBodyAttributeTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithBodyAttributeTests.cs index 62d1b49c..f9f19835 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithBodyAttributeTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithBodyAttributeTests.cs @@ -17,10 +17,10 @@ public void Given_Null_When_Instantiated_Then_It_Should_Throw_Exception() { var statusCode = HttpStatusCode.OK; - Action action = () => new OpenApiResponseWithBodyAttribute(statusCode, null, null); + Action action = () => new OpenApiResponseWithBodyAttribute(statusCode, null, null, "GET"); action.Should().Throw(); - action = () => new OpenApiResponseWithBodyAttribute(statusCode, "hello world", null); + action = () => new OpenApiResponseWithBodyAttribute(statusCode, "hello world", null, "GET"); action.Should().Throw(); } @@ -28,7 +28,7 @@ public void Given_Null_When_Instantiated_Then_It_Should_Throw_Exception() [DataRow(HttpStatusCode.OK, "application/json", typeof(object))] public void Given_Parameters_When_Instantiated_Then_It_Should_Return_Value(HttpStatusCode statusCode, string contentType, Type bodyType) { - var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType); + var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType, "GET"); attribute.StatusCode.Should().Be(statusCode); attribute.ContentType.Should().BeEquivalentTo(contentType); @@ -43,7 +43,7 @@ public void Given_Properties_When_Instantiated_Then_It_Should_Return_Value(strin var statusCode = HttpStatusCode.OK; var contentType = "application/json"; var bodyType = typeof(object); - var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType) + var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType, "GET") { Summary = summary, Description = description, diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithoutBodyAttributeTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithoutBodyAttributeTests.cs index e25e3949..96a7683d 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithoutBodyAttributeTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithoutBodyAttributeTests.cs @@ -16,7 +16,7 @@ public class OpenApiResponseWithoutBodyAttributeTests public void Given_Parameters_When_Instantiated_Then_It_Should_Return_Value() { var statusCode = HttpStatusCode.OK; - var attribute = new OpenApiResponseWithoutBodyAttribute(statusCode); + var attribute = new OpenApiResponseWithoutBodyAttribute(statusCode, "GET"); attribute.StatusCode.Should().Be(statusCode); attribute.Summary.Should().BeNullOrWhiteSpace(); @@ -28,7 +28,7 @@ public void Given_Parameters_When_Instantiated_Then_It_Should_Return_Value() public void Given_Properties_When_Instantiated_Then_It_Should_Return_Value(string summary, string description, Type headerType) { var statusCode = HttpStatusCode.OK; - var attribute = new OpenApiResponseWithoutBodyAttribute(statusCode) + var attribute = new OpenApiResponseWithoutBodyAttribute(statusCode, "GET") { Summary = summary, Description = description, diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiSecurityAttributeTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiSecurityAttributeTests.cs index b31b469d..0bb58fbb 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiSecurityAttributeTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiSecurityAttributeTests.cs @@ -14,7 +14,7 @@ public class OpenApiSecurityAttributeTests [TestMethod] public void Given_NullValue_Constructor_Should_Throw_Exception() { - Action action = () => new OpenApiSecurityAttribute(null, SecuritySchemeType.ApiKey); + Action action = () => new OpenApiSecurityAttribute(null, SecuritySchemeType.ApiKey, "GET"); action.Should().Throw(); } @@ -22,7 +22,7 @@ public void Given_NullValue_Constructor_Should_Throw_Exception() [DataRow("authKey", SecuritySchemeType.ApiKey)] public void Given_Value_Property_Should_Return_Value(string schemeName, SecuritySchemeType schemeType) { - var attribute = new OpenApiSecurityAttribute(schemeName, schemeType); + var attribute = new OpenApiSecurityAttribute(schemeName, schemeType, "GET"); attribute.SchemeName.Should().Be(schemeName); attribute.SchemeType.Should().Be(schemeType); diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiParameterAttributeExtensionsTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiParameterAttributeExtensionsTests.cs index 9f0a14f8..a66a9219 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiParameterAttributeExtensionsTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiParameterAttributeExtensionsTests.cs @@ -30,7 +30,7 @@ public void Given_Null_When_ToOpenApiParameter_Invoked_Then_It_Should_Throw_Exce [TestMethod] public void Given_Value_When_ToOpenApiParameter_Invoked_Then_It_Should_Return_Result() { - var attribute = new OpenApiParameterAttribute("hello") + var attribute = new OpenApiParameterAttribute("hello", "GET") { Type = typeof(string), Description = "hello world", @@ -49,7 +49,7 @@ public void Given_Value_When_ToOpenApiParameter_Invoked_Then_It_Should_Return_Re [TestMethod] public void Given_Value_With_String_Type_When_ToOpenApiParameter_Invoked_Then_It_Should_Return_Result() { - var attribute = new OpenApiParameterAttribute("hello") + var attribute = new OpenApiParameterAttribute("hello", "GET") { Type = typeof(string), Description = "hello world", @@ -66,7 +66,7 @@ public void Given_Value_With_String_Type_When_ToOpenApiParameter_Invoked_Then_It [TestMethod] public void Given_Value_With_Int_Type_When_ToOpenApiParameter_Invoked_Then_It_Should_Return_Result() { - var attribute = new OpenApiParameterAttribute("hello") + var attribute = new OpenApiParameterAttribute("hello", "GET") { Type = typeof(int), Description = "hello world", @@ -83,7 +83,7 @@ public void Given_Value_With_Int_Type_When_ToOpenApiParameter_Invoked_Then_It_Sh [TestMethod] public void Given_Value_With_Long_Type_When_ToOpenApiParameter_Invoked_Then_It_Should_Return_Result() { - var attribute = new OpenApiParameterAttribute("hello") + var attribute = new OpenApiParameterAttribute("hello", "GET") { Type = typeof(long), Description = "hello world", @@ -102,7 +102,7 @@ public void Given_Value_With_Enum_Type_When_ToOpenApiParameter_Invoked_Then_It_S { var strategy = new CamelCaseNamingStrategy(); var names = typeof(FakeStringEnum).ToOpenApiStringCollection(strategy).Select(p => (p as OpenApiString).Value).ToList(); - var attribute = new OpenApiParameterAttribute("hello") + var attribute = new OpenApiParameterAttribute("hello", "GET") { Type = typeof(FakeStringEnum), Description = "hello world", @@ -127,7 +127,7 @@ public void Given_Value_With_List_Enum_Type_When_ToOpenApiParameter_Invoked_Then { var strategy = new CamelCaseNamingStrategy(); var names = typeof(FakeStringEnum).ToOpenApiStringCollection(strategy).Select(p => (p as OpenApiString).Value).ToList(); - var attribute = new OpenApiParameterAttribute("hello") + var attribute = new OpenApiParameterAttribute("hello", "GET") { Type = typeof(List), Description = "hello world", @@ -150,7 +150,7 @@ public void Given_Value_With_List_Enum_Type_When_ToOpenApiParameter_Invoked_Then [TestMethod] public void Given_Value_With_Summary_When_ToOpenApiParameter_Invoked_Then_It_Should_Return_Result() { - var attribute = new OpenApiParameterAttribute("hello") + var attribute = new OpenApiParameterAttribute("hello", "GET") { Type = typeof(long), Summary = "lorem ipsum", @@ -173,7 +173,7 @@ public void Given_Value_With_Summary_When_ToOpenApiParameter_Invoked_Then_It_Sho [DataRow(null)] public void Given_Value_With_Visibility_When_ToOpenApiParameter_Invoked_Then_It_Should_Return_Result(OpenApiVisibilityType? visibility) { - var attribute = new OpenApiParameterAttribute("hello") + var attribute = new OpenApiParameterAttribute("hello", "GET") { Type = typeof(long), Summary = "lorem ipsum", @@ -207,7 +207,7 @@ public void Given_Value_With_Visibility_When_ToOpenApiParameter_Invoked_Then_It_ [DataRow(null)] public void Given_Value_With_Deprecated_When_ToOpenApiParameter_Invoked_Then_It_Should_Return_Result(bool? deprecated) { - var attribute = new OpenApiParameterAttribute("hello") + var attribute = new OpenApiParameterAttribute("hello", "GET") { Type = typeof(long), Summary = "lorem ipsum", @@ -229,7 +229,7 @@ public void Given_Value_With_Deprecated_When_ToOpenApiParameter_Invoked_Then_It_ [TestMethod] public void Given_Value_With_Examples_When_ToOpenApiParameter_Invoked_With_OpenApi_V3_Then_It_Should_Return_Result() { - var attribute = new OpenApiParameterAttribute("hello") + var attribute = new OpenApiParameterAttribute("hello", "GET") { Type = typeof(string), Summary = "lorem ipsum", diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiPayloadAttributeExtensionsTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiPayloadAttributeExtensionsTests.cs index aaa2d607..e943fd79 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiPayloadAttributeExtensionsTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiPayloadAttributeExtensionsTests.cs @@ -34,7 +34,7 @@ public void Given_Null_When_ToOpenApiMediaType_Invoked_Then_It_Should_Throw_Exce public void Given_OpenApiRequestBodyAttribute_When_ToOpenApiMediaType_Invoked_Then_It_Should_Return_Result(Type bodyType, string expected) { var contentType = "application/json"; - var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType) + var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType, "GET") { Required = true, Description = "Dummy request model" @@ -54,7 +54,7 @@ public void Given_OpenApiRequestBodyAttribute_With_Deprecated_When_ToOpenApiMedi { var contentType = "application/json"; var bodyType = typeof(object); - var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType) + var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType, "GET") { Required = true, Description = "Dummy request model", @@ -75,7 +75,7 @@ public void Given_OpenApiRequestBodyAttribute_With_Example_When_ToOpenApiMediaTy { var contentType = "application/json"; var bodyType = typeof(object); - var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType) + var attribute = new OpenApiRequestBodyAttribute(contentType, bodyType, "GET") { Example = example, }; @@ -96,7 +96,7 @@ public void Given_OpenApiResponseWithBodyAttribute_When_ToOpenApiMediaType_Invok { var statusCode = HttpStatusCode.OK; var contentType = "application/json"; - var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType); + var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType, "GET"); var namingStrategy = new CamelCaseNamingStrategy(); var result = OpenApiPayloadAttributeExtensions.ToOpenApiMediaType(attribute, namingStrategy); @@ -132,7 +132,7 @@ public void Given_OpenApiResponseWithBodyAttribute_With_Deprecated_When_ToOpenAp var statusCode = HttpStatusCode.OK; var contentType = "application/json"; var bodyType = typeof(object); - var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType) + var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType, "GET") { Deprecated = deprecated, }; @@ -144,18 +144,18 @@ public void Given_OpenApiResponseWithBodyAttribute_With_Deprecated_When_ToOpenAp } [DataTestMethod] - [DataRow(null, 0, OpenApiVersionType.V2)] - [DataRow(typeof(FakeModel), 0, OpenApiVersionType.V2)] - [DataRow(typeof(FakeExample), 3, OpenApiVersionType.V2)] - [DataRow(null, 0, OpenApiVersionType.V3)] - [DataRow(typeof(FakeModel), 0, OpenApiVersionType.V3)] - [DataRow(typeof(FakeExample), 3, OpenApiVersionType.V3)] - public void Given_OpenApiResponseWithBodyAttribute_With_Example_When_ToOpenApiMediaType_Invoked_Then_It_Should_Return_Result(Type example, int count, OpenApiVersionType version) + [DataRow(null, 0, OpenApiVersionType.V2, "GET")] + [DataRow(typeof(FakeModel), 0, OpenApiVersionType.V2, "GET")] + [DataRow(typeof(FakeExample), 3, OpenApiVersionType.V2, "GET")] + [DataRow(null, 0, OpenApiVersionType.V3, "GET")] + [DataRow(typeof(FakeModel), 0, OpenApiVersionType.V3, "GET")] + [DataRow(typeof(FakeExample), 3, OpenApiVersionType.V3, "GET")] + public void Given_OpenApiResponseWithBodyAttribute_With_Example_When_ToOpenApiMediaType_Invoked_Then_It_Should_Return_Result(Type example, int count, OpenApiVersionType version, string verb) { var statusCode = HttpStatusCode.OK; var contentType = "application/json"; var bodyType = typeof(object); - var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType) + var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType, verb) { Example = example, }; diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithBodyAttributeExtensionsTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithBodyAttributeExtensionsTests.cs index a334b3a9..48b016eb 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithBodyAttributeExtensionsTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithBodyAttributeExtensionsTests.cs @@ -29,7 +29,7 @@ public void Given_Properties_When_ToOpenApiResponse_Invoked_Then_It_Should_Retur var statusCode = HttpStatusCode.OK; var contentType = "application/json"; var bodyType = typeof(object); - var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType) + var attribute = new OpenApiResponseWithBodyAttribute(statusCode, contentType, bodyType, "GET") { Summary = summary, Description = description, diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithoutBodyAttributeExtensionsTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithoutBodyAttributeExtensionsTests.cs index fa241216..0164bdf7 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithoutBodyAttributeExtensionsTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithoutBodyAttributeExtensionsTests.cs @@ -27,7 +27,7 @@ public void Given_Null_When_ToOpenApiResponse_Invoked_Then_It_Should_Throw_Excep public void Given_Properties_When_ToOpenApiResponse_Invoked_Then_It_Should_Return_Value(string summary, string description, Type headerType) { var statusCode = HttpStatusCode.OK; - var attribute = new OpenApiResponseWithoutBodyAttribute(statusCode) + var attribute = new OpenApiResponseWithoutBodyAttribute(statusCode, "GET") { Summary = summary, Description = description,