Created
April 15, 2019 00:38
-
-
Save yuka1984/5c0eeae36091151737b44de2263532a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net.Http; | |
using System.Threading.Tasks; | |
using AzureFunctions.Extensions.Swashbuckle; | |
using AzureFunctions.Extensions.Swashbuckle.Attribute; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Extensions.Http; | |
namespace SampleFunction | |
{ | |
public static class SwaggerFunctions | |
{ | |
[SwaggerIgnore] | |
[FunctionName("Swagger")] | |
public static Task<HttpResponseMessage> Swagger( | |
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "swagger/json")] | |
HttpRequestMessage req, | |
[SwashBuckleClient] ISwashBuckleClient swashBuckleClient) | |
{ | |
return Task.FromResult(swashBuckleClient.CreateSwaggerDocumentResponse(req)); | |
} | |
[SwaggerIgnore] | |
[FunctionName("SwaggerUi")] | |
public static Task<HttpResponseMessage> SwaggerUi( | |
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "swagger/ui")] | |
HttpRequestMessage req, | |
[SwashBuckleClient] ISwashBuckleClient swashBuckleClient) | |
{ | |
return Task.FromResult(swashBuckleClient.CreateSwaggerUIResponse(req, "swagger/json")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment