public static async Task <IActionResult> RunAsync(
     [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = APIDefRoute)] HttpRequest req,
     ILogger log,
     [Inject] ISwaggerDocumentGenerator swaggerGenerator)
 {
     return(await Task.FromResult((ActionResult) new OkObjectResult(swaggerGenerator.GenerateSwaggerDocument(req, APITitle, APIDescription, APIDefinitionName, Assembly.GetExecutingAssembly()))));
 }
        /// <summary>
        /// initialise an instance of the <see cref="ApiDefinitionFunction"/>
        /// </summary>
        /// <param name="generator">(the swagger document) generator</param>
        public ApiDefinitionFunction(ISwaggerDocumentGenerator generator)
        {
            It.IsNull(generator)
            .AsGuard <ArgumentNullException>(nameof(generator));

            Generator = generator;
        }
 public void Setup()
 {
     _swaggerDocumentGenerator = Substitute.For <ISwaggerDocumentGenerator>();
     _request = new DefaultHttpRequest(new DefaultHttpContext())
     {
         ContentType = "application/json",
     };
     _assembly = Assembly.GetExecutingAssembly();
 }
        public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = APIDefRoute)] HttpRequest req,
                                              [Inject] ISwaggerDocumentGenerator swaggerDocumentGenerator)
        {
            var swagger = swaggerDocumentGenerator.GenerateSwaggerDocument(req, APITitle, APIDescription, APIDefinitionName, Assembly.GetExecutingAssembly());

            return(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(swagger)
            });
        }
        public static HttpResponseMessage Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = ApiDefRoute)]
            HttpRequest req,
            ILogger logger,
            [Inject] ISwaggerDocumentGenerator swaggerDocumentGenerator,
            [Inject] ILoggerHelper loggerHelper
            )
        {
            string ApiSuffix = Environment.GetEnvironmentVariable("ApiSuffix");
            string ApiTitle  = "Composite Paths " + ApiSuffix;

            loggerHelper.LogMethodEnter(logger);

            var swagger = swaggerDocumentGenerator.GenerateSwaggerDocument(req, ApiTitle, ApiDescription, ApiDefinitionName, ApiVersion, Assembly.GetExecutingAssembly());

            loggerHelper.LogMethodExit(logger);

            return(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(swagger)
            });
        }
示例#6
0
 public ApiDefinition(ISwaggerDocumentGenerator swaggerDocumentGenerator)
 {
     this.swaggerDocumentGenerator = swaggerDocumentGenerator;
 }
示例#7
0
 /// <summary>
 /// make (a) 'system under test'
 /// </summary>
 /// <param name="generator">the document generator</param>
 /// <returns>the system under test</returns>
 internal ApiDefinitionFunction MakeSUT(ISwaggerDocumentGenerator generator) =>
 new ApiDefinitionFunction(generator);
 public ApiDefinition(ISwaggerDocumentGenerator swaggerDocumentGenerator, EnvironmentValues environmentValues)
 {
     this.swaggerDocumentGenerator = swaggerDocumentGenerator;
     this.environmentValues        = environmentValues;
 }
 public GenerateCustomerSwaggerDoc(ISwaggerDocumentGenerator swaggerDocumentGenerator)
 {
     _swaggerDocumentGenerator = swaggerDocumentGenerator;
 }