Home:ALL Converter>Custom Index Swashbuckle/Swagger

Custom Index Swashbuckle/Swagger

Ask Time:2018-06-01T00:26:23         Author:Yitzak Hernandez

Json Formatter

this is my first time using Swagger, I'm currently using Swashbuckle.AspNetCore v2.4.0 and trying to implement a custom index page. In this version they have removed the possibility of injecting javascript, and I'm essentially stuck with the only option of making a custom index.html page just to edit some links (most specifically the navigation icon link). I'm trying to get my custom index page to work but I'm having trouble getting it to load.

app.UseSwaggerUI(c =>
{
    c.IndexStream = () => GetType().GetTypeInfo().Assembly
        .GetManifestResourceStream("customSwaggerIndex.html"); // requires file to be added as an embedded resource
});

I have the following in my code with the customSwaggerIndex.html saved on the wwwroot folder and its Build Action set as Embedded resource, but I keep running into the error System.ArgumentNullException: Value cannot be null. This is most likely due to me not properly writing the GetManifestResourceStream("string"). Any help?

Author:Yitzak Hernandez,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50628819/custom-index-swashbuckle-swagger
yy