Enable XML comment support for Swashbuckle
This commit is contained in:
parent
5cc5a5b4a7
commit
599dfcc071
@ -1,9 +1,15 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- This enables XML generation for Swashbuckle -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PluralKit.Core\PluralKit.Core.csproj" />
|
<ProjectReference Include="..\PluralKit.Core\PluralKit.Core.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
using Autofac;
|
using Autofac;
|
||||||
|
|
||||||
@ -60,6 +62,12 @@ namespace PluralKit.API
|
|||||||
if (!apiDesc.RelativePath.StartsWith("v1/")) return false;
|
if (!apiDesc.RelativePath.StartsWith("v1/")) return false;
|
||||||
return apiDesc.GroupName == docName;
|
return apiDesc.GroupName == docName;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Set the comments path for the Swagger JSON and UI.
|
||||||
|
// https://docs.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-3.1&tabs=visual-studio#customize-and-extend
|
||||||
|
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||||
|
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
||||||
|
c.IncludeXmlComments(xmlPath);
|
||||||
});
|
});
|
||||||
services.AddSwaggerGenNewtonsoftSupport();
|
services.AddSwaggerGenNewtonsoftSupport();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user