refactor(arc): ♻ sync some config from dir

This commit is contained in:
Collin M. Barrett 2021-11-26 17:01:50 -06:00
parent 3eca3ddf9c
commit 9ed0430a9d
4 changed files with 30 additions and 16 deletions

View file

@ -19,5 +19,10 @@
app.UseExceptionHandler(app.Environment.IsDevelopment() ? "/error-local-development" : "/error");
app.UseSwagger();
app.MapControllers();
app.Use(async (context, next) =>
{
context.Request.PathBase = "/api/archival";
await next.Invoke();
});
await app.TryRunWithLoggingAsync();

View file

@ -11,23 +11,30 @@ public static void AddSwaggerGen(this IServiceCollection services)
{
o.SupportNonNullableReferenceTypes();
o.SwaggerDoc("v1", new OpenApiInfo
{
Title = "FilterLists Archival API",
Description =
"An ASP.NET Core API archiving and serving copies of FilterLists for mirrors and analysis.",
Version = "v1",
//TermsOfService = "",
Contact = new OpenApiContact { Name = "FilterLists", Url = new Uri("https://filterlists.com") },
License = new OpenApiLicense
o.SwaggerDoc(
"v1",
new OpenApiInfo
{
Name = "MIT License",
Url = new Uri("https://github.com/collinbarrett/FilterLists/blob/master/LICENSE")
}
});
Title = "FilterLists Archival API",
Description = "An ASP.NET Core API archiving and serving copies of FilterLists for mirrors and analysis.",
Version = "v1",
//TermsOfService = "",
Contact = new OpenApiContact { Name = "FilterLists", Url = new Uri("https://filterlists.com") },
License = new OpenApiLicense
{
Name = "MIT License",
Url = new Uri("https://github.com/collinbarrett/FilterLists/blob/master/LICENSE")
}
});
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
o.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFile));
// Swagger UI struggles with lookups of nested types represented by concatenated '+'
o.CustomSchemaIds(t => t.FullName?.Replace("+", "."));
var apiXmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
o.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, apiXmlFile));
var applicationXmlFile = $"{typeof(Application.ConfigurationExtensions).Assembly.GetName().Name}.xml";
o.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, applicationXmlFile));
});
}

View file

@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup>

View file

@ -11,7 +11,8 @@ public static void AddSwaggerGen(this IServiceCollection services)
{
o.SupportNonNullableReferenceTypes();
o.SwaggerDoc("v1",
o.SwaggerDoc(
"v1",
new OpenApiInfo
{
Title = "FilterLists Directory API",