コード例 #1
0
 public SwaggerMiddleware(
     RequestDelegate next,
     SwaggerOptions options)
 {
     _next                   = next;
     _options                = options ?? new SwaggerOptions();
     _requestMatcher         = new TemplateMatcher(TemplateParser.Parse(_options.RouteTemplate), new RouteValueDictionary());
     _swaggerDocumentBuilder = new SwaggerDocumentBuilder(_options);
 }
コード例 #2
0
        public virtual IActionResult Get(string documentName)
        {
            var swaggerProvider = GetSwaggerProvider();
            var options         = GetSwaggerOptions();

            var builder = new SwaggerDocumentBuilder(options);

            var result = builder.Build(
                HttpContext.Request,
                swaggerProvider,
                documentName);

            return(Content(result, "application/json"));
        }