Skip to content

Commit ae534cd

Browse files
committed
Added XML comments to Swagger documentation
1 parent e8d7cfc commit ae534cd

File tree

5 files changed

+108
-1
lines changed

5 files changed

+108
-1
lines changed

src/App/Startup.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
using Microsoft.Extensions.DependencyInjection;
1414
using Serilog;
1515
using Serilog.Events;
16+
using System;
1617
using System.Globalization;
18+
using System.IO;
1719
using System.Reflection;
1820

1921
namespace App
@@ -109,6 +111,7 @@ public void ConfigureServices(IServiceCollection services)
109111
Title = "Blogifier API",
110112
Version = "1"
111113
});
114+
setupAction.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "CoreAPI.xml"));
112115
});
113116

114117
services.AddAppServices();

src/Core/Api/AssetsController.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ public AssetsController(IDataService data, IStorageService store)
2323
_store = store;
2424
}
2525

26+
/// <summary>
27+
/// Get list of assets - user saved images and files
28+
/// </summary>
29+
/// <param name="page">Page number</param>
30+
/// <param name="filter">filterImages or filterAttachments</param>
31+
/// <param name="search">Search term</param>
32+
/// <returns>Model containing collection of assets and Pager object</returns>
2633
[HttpGet]
2734
public async Task<AssetsModel> Get(int page = 1, string filter = "", string search = "")
2835
{
@@ -59,6 +66,13 @@ public async Task<AssetsModel> Get(int page = 1, string filter = "", string sear
5966
};
6067
}
6168

69+
/// <summary>
70+
/// Select an asset in the File Manager to include in the post
71+
/// </summary>
72+
/// <param name="type">Type of asset (post cover, logo, avatar or post image/attachment)</param>
73+
/// <param name="asset">Selected asset</param>
74+
/// <param name="post">Post ID</param>
75+
/// <returns>Asset Item</returns>
6276
[HttpGet("pick")]
6377
public async Task<AssetItem> Pick(string type, string asset, string post)
6478
{
@@ -95,6 +109,11 @@ public async Task<AssetItem> Pick(string type, string asset, string post)
95109
return item.FirstOrDefault();
96110
}
97111

112+
/// <summary>
113+
/// Upload file(s) to user data store
114+
/// </summary>
115+
/// <param name="files">Selected files</param>
116+
/// <returns>Success or internal error</returns>
98117
[HttpPost("upload")]
99118
public async Task<IActionResult> Upload(ICollection<IFormFile> files)
100119
{
@@ -112,6 +131,11 @@ public async Task<IActionResult> Upload(ICollection<IFormFile> files)
112131
}
113132
}
114133

134+
/// <summary>
135+
/// Remove file from user data store, authentication required
136+
/// </summary>
137+
/// <param name="url">Relative URL of the file to remove</param>
138+
/// <returns></returns>
115139
[HttpDelete("remove")]
116140
public IActionResult Remove(string url)
117141
{

src/Core/Core.csproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp2.2</TargetFramework>
5-
<Version>2.3.1.2</Version>
5+
<Version>2.3.1.3</Version>
6+
</PropertyGroup>
7+
8+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
9+
<DocumentationFile>CoreAPI.xml</DocumentationFile>
10+
<NoWarn>1701;1702;1591</NoWarn>
611
</PropertyGroup>
712

813
<ItemGroup>
@@ -17,4 +22,10 @@
1722
<PackageReference Include="Sendgrid" Version="9.10.0" />
1823
</ItemGroup>
1924

25+
<ItemGroup>
26+
<None Update="CoreAPI.xml">
27+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
28+
</None>
29+
</ItemGroup>
30+
2031
</Project>

src/Core/CoreAPI.xml

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Core/Data/Domain/Author.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ public class Author
77
{
88
public Author() { }
99

10+
/// <summary>
11+
/// Author ID
12+
/// </summary>
1013
public int Id { get; set; }
1114

1215
[StringLength(160)]

0 commit comments

Comments
 (0)