Пример #1
0
 public RedocFoldersAsTagGroupsFilesAsTagsDocFilter(IHttpContextAccessor hcx, IWikiMarkdownHandler markdownHandler, IOptions <RedocUiOptions> options, IOptions <SwaggerDocOptions> docOptions)
 {
     this.hcx             = hcx ?? throw new System.ArgumentNullException(nameof(hcx));
     this.markdownHandler = markdownHandler ?? throw new System.ArgumentNullException(nameof(markdownHandler));
     this.options         = options?.Value ?? throw new System.ArgumentNullException(nameof(options));
     this.docOptions      = docOptions?.Value ?? throw new System.ArgumentNullException(nameof(docOptions));
 }
Пример #2
0
        public ReallySimpleDocumentationBuilder WithRedoc(Action <RedocUiOptions> redocOptions = null)
        {
            var opts = new RedocUiOptions();

            redocOptions?.Invoke(opts);
            services.AddSingleton(Options.Create(opts));
            services.Configure <SwaggerGenOptions>(c =>
            {
                switch (opts.WikiNavigationMode)
                {
                case RedocNavigationMode.FoldersAsTagGroupsFilesAsTags:
                    c.DocumentFilter <RedocFoldersAsTagGroupsFilesAsTagsDocFilter>();
                    break;

                case RedocNavigationMode.FoldersAsTagsFilesAsHeadings:
                    c.DocumentFilter <RedocFoldersAsTagsFilesAsHeadingsDocFilter>();
                    break;
                }
            });
            return(this);
        }
Пример #3
0
        public SwaggerUIWikiFactory(IWikiMarkdownHandler markdownHandler, IOptions <SwaggerUIWikiOptions> options, IOptions <RedocUiOptions> redocOptions)
        {
            this.options         = options?.Value ?? throw new ArgumentNullException(nameof(options));
            this.redocOptions    = redocOptions?.Value ?? throw new ArgumentNullException(nameof(redocOptions));
            this.wikiHtmlSection = new Lazy <string>(BuildWikiHtmlSection);
            this.markdownHandler = markdownHandler ?? throw new ArgumentNullException(nameof(markdownHandler));

            switch (this.redocOptions.WikiNavigationMode)
            {
            case RedocNavigationMode.FoldersAsTagGroupsFilesAsTags:
                this.idSlug = "tag";
                break;

            case RedocNavigationMode.FoldersAsTagsFilesAsHeadings:
                this.idSlug = "section";
                break;

            default:
                throw new NotImplementedException();
            }
        }