Skip to content

Commit 9790211

Browse files
committed
[r] XML comments
1 parent 4bc010b commit 9790211

9 files changed

Lines changed: 89 additions & 47 deletions

src/Simplify.Web.Swagger/ControllerAction.cs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,48 @@
66
namespace Simplify.Web.Swagger
77
{
88
/// <summary>
9-
/// Represent controller action
9+
/// Provides the controller action.
1010
/// </summary>
1111
public class ControllerAction
1212
{
1313
private ControllerActionNames? _names;
1414
private IControllerRoute? _controllerRoute;
1515

1616
/// <summary>
17-
/// Request body
17+
/// Gets or sets the request body.
1818
/// </summary>
19+
/// <value>
20+
/// The request body.
21+
/// </value>
1922
public OpenApiRequestBody RequestBody { get; set; } = new();
2023

2124
/// <summary>
22-
/// Controller responses
25+
/// Gets or sets the responses.
2326
/// </summary>
27+
/// <value>
28+
/// The responses.
29+
/// </value>
2430
public IDictionary<int, OpenApiResponse> Responses { get; set; } = new Dictionary<int, OpenApiResponse>();
2531

2632
/// <summary>
27-
/// Operation type
33+
/// Gets or sets the type.
2834
/// </summary>
35+
/// <value>
36+
/// The type.
37+
/// </value>
2938
public OperationType Type { get; set; }
3039

3140
/// <summary>
32-
/// Controller path
41+
/// Gets the path.
3342
/// </summary>
43+
/// <value>
44+
/// The path.
45+
/// </value>
3446
#if NETSTANDARD2_0
3547
public string Path => ControllerRoute.Path.StartsWith("/") ? ControllerRoute.Path : "/" + ControllerRoute.Path;
3648
#else
3749
public string Path => ControllerRoute.Path.StartsWith('/') ? ControllerRoute.Path : "/" + ControllerRoute.Path;
50+
3851
#endif
3952

4053
/// <summary>
@@ -51,8 +64,12 @@ public IControllerRoute ControllerRoute
5164
}
5265

5366
/// <summary>
54-
/// Controller names
67+
/// Gets or sets the names.
5568
/// </summary>
69+
/// <value>
70+
/// The names.
71+
/// </value>
72+
/// <exception cref="InvalidOperationException">Names is null</exception>
5673
public ControllerActionNames Names
5774
{
5875
get => _names ?? throw new InvalidOperationException("Names is null");
@@ -62,6 +79,9 @@ public ControllerActionNames Names
6279
/// <summary>
6380
/// Gets or sets the value indicating whether controller requires user authorization.
6481
/// </summary>
82+
/// <value>
83+
/// <c>true</c> if this instance is authorization required; otherwise, <c>false</c>.
84+
/// </value>
6585
public bool IsAuthorizationRequired { get; set; }
6686
}
6787
}
Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
namespace Simplify.Web.Swagger
22
{
33
/// <summary>
4-
/// provides controller action names
4+
/// Provides the controller action names.
55
/// </summary>
6-
public class ControllerActionNames
6+
/// <remarks>
7+
/// Initializes ControllerActionNames.
8+
/// </remarks>
9+
/// <param name="name">Controller full name</param>
10+
/// <param name="groupName">Controller group name</param>
11+
/// <param name="summary">Controller summary</param>
12+
public class ControllerActionNames(string name, string groupName, string? summary = null)
713
{
814
/// <summary>
9-
/// Initializes ControllerActionNames
15+
/// Gets or sets the controller full name
1016
/// </summary>
11-
/// <param name="name">Controller full name</param>
12-
/// <param name="groupName">Controller group name</param>
13-
/// <param name="summary">Controller summary</param>
14-
public ControllerActionNames(string name, string groupName, string? summary = null)
15-
{
16-
Name = name;
17-
GroupName = groupName;
18-
Summary = summary;
19-
}
17+
/// <value>
18+
/// The name.
19+
/// </value>
20+
public string Name { get; set; } = name;
2021

2122
/// <summary>
22-
/// Controller full name
23+
/// Gets or sets the controller group name
2324
/// </summary>
24-
public string Name { get; set; }
25+
/// <value>
26+
/// The name of the group.
27+
/// </value>
28+
public string GroupName { get; set; } = groupName;
2529

2630
/// <summary>
27-
/// Controller group name
31+
/// Gets or sets the controller summary
2832
/// </summary>
29-
public string GroupName { get; set; }
30-
31-
/// <summary>
32-
/// Controller summary
33-
/// </summary>
34-
public string? Summary { get; set; }
33+
/// <value>
34+
/// The summary.
35+
/// </value>
36+
public string? Summary { get; set; } = summary;
3537
}
3638
}

src/Simplify.Web.Swagger/ControllerActionsFactory.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Simplify.Web.Swagger
1313
{
1414
/// <summary>
15-
/// Provides ControllerAction factory
15+
/// Provides the controller action factory.
1616
/// </summary>
1717
public static class ControllerActionsFactory
1818
{
@@ -44,18 +44,21 @@ public static class ControllerActionsFactory
4444
];
4545

4646
/// <summary>
47-
/// Provides controller prefixes to remove
47+
/// Gets the remove prefixes.
4848
/// </summary>
49+
/// <value>
50+
/// The remove prefixes.
51+
/// </value>
4952
public static IList<string> RemovePrefixes { get; } =
5053
[
5154
"Controllers.",
5255
"Api.v1."
5356
];
5457

5558
/// <summary>
56-
/// Creates controller actions from Simplify.Web controller meta data
59+
/// Creates the controller actions from controllers metadata.
5760
/// </summary>
58-
/// <returns></returns>
61+
/// <param name="context">The context.</param>
5962
public static IEnumerable<ControllerAction> CreateControllerActionsFromControllersMetaData(DocumentFilterContext context) =>
6063
ControllersMetaStore.Current.RoutedControllers
6164
.SelectMany(item => CreateControllerActions(item, context));

src/Simplify.Web.Swagger/ProducesResponseAttribute.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
namespace Simplify.Web.Swagger;
55

66
/// <summary>
7-
/// A filter that specifies the type of the value and status code returned by the controller.
7+
/// Provides the filter that specifies the type of the value and status code returned by the controller.
88
/// </summary>
99
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
1010
public class ProducesResponseAttribute : Attribute
1111
{
1212
/// <summary>
13-
/// Initializes an instance of <see cref="ProducesResponseAttribute"/>.
13+
/// Initializes an instance of <see cref="ProducesResponseAttribute" />.
1414
/// </summary>
1515
/// <param name="statusCode">The HTTP response status code.</param>
1616
/// <param name="contentType">The content type associated with the response.</param>
@@ -35,27 +35,36 @@ public ProducesResponseAttribute(int statusCode, Type? type = null, string? cont
3535
if (!string.IsNullOrEmpty(contentType))
3636
ContentTypes.Add(contentType!);
3737

38-
for (var i = 0; i < additionalContentTypes.Length; i++)
38+
foreach (var t in additionalContentTypes)
3939
{
40-
if (string.IsNullOrEmpty(additionalContentTypes[i]))
40+
if (string.IsNullOrEmpty(t))
4141
continue;
4242

43-
ContentTypes.Add(additionalContentTypes[i]);
43+
ContentTypes.Add(t);
4444
}
4545
}
4646

4747
/// <summary>
4848
/// Gets the HTTP status code of the response.
4949
/// </summary>
50+
/// <value>
51+
/// The status code.
52+
/// </value>
5053
public int StatusCode { get; }
5154

5255
/// <summary>
5356
/// Gets the type of the value returned by a controller.
5457
/// </summary>
58+
/// <value>
59+
/// The type.
60+
/// </value>
5561
public Type? Type { get; }
5662

5763
/// <summary>
5864
/// Gets the HTTP content types of the response
5965
/// </summary>
60-
public IList<string> ContentTypes { get; } = new List<string>();
66+
/// <value>
67+
/// The content types.
68+
/// </value>
69+
public IList<string> ContentTypes { get; } = [];
6170
}

src/Simplify.Web.Swagger/RequestBodyAttribute.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Simplify.Web.Swagger;
44

55
/// <summary>
6-
/// A filter that specifies the request body received by the controller.
6+
/// Provides the filter that specifies the request body received by the controller.
77
/// </summary>
88
/// <seealso cref="Attribute" />
99
/// <remarks>
@@ -16,5 +16,8 @@ public class RequestBodyAttribute(Type model) : Attribute
1616
/// <summary>
1717
/// Request body model type
1818
/// </summary>
19+
/// <value>
20+
/// The model.
21+
/// </value>
1922
public Type Model { get; private set; } = model ?? throw new ArgumentNullException(nameof(model));
2023
}

src/Simplify.Web.Swagger/RoutesExtensions.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
namespace Simplify.Web.Swagger
66
{
77
/// <summary>
8-
/// Provides Routes extension methods
8+
/// Provides the routes extension methods.
99
/// </summary>
1010
public static class RoutesExtensions
1111
{
1212
/// <summary>
1313
/// Check if the controller have duplicate paths
1414
/// </summary>
15-
/// <param name="items"></param>
16-
/// <returns></returns>
15+
/// <param name="items">The items.</param>
16+
/// <returns>
17+
/// <c>true</c> if the specified items contains duplicates; otherwise, <c>false</c>.
18+
/// </returns>
1719
public static bool ContainsDuplicates(this IDictionary<HttpMethod, string> items) =>
1820
items.GroupBy(x => x.Value).Any(g => g.Count() > 1);
1921
}

src/Simplify.Web.Swagger/SimplifyWebDocumentFilter.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@
77
namespace Simplify.Web.Swagger
88
{
99
/// <summary>
10-
/// Provides Swagger DocumentFilter for Simplify.Web framework
10+
/// Provides the Swagger <see cref="IDocumentFilter" /> implementation for Simplify.Web framework.
1111
/// </summary>
12+
/// <seealso cref="IDocumentFilter" />
1213
public class SimplifyWebDocumentFilter : IDocumentFilter
1314
{
1415
private readonly SimplifyWebSwaggerArgs? _args;
1516

1617
/// <summary>
17-
/// Initializes an instance of <see cref="SimplifyWebDocumentFilter"/>.
18+
/// Initializes an instance of <see cref="SimplifyWebDocumentFilter" />.
1819
/// </summary>
1920
public SimplifyWebDocumentFilter()
2021
{
2122
}
2223

2324
/// <summary>
24-
/// Initializes an instance of <see cref="SimplifyWebDocumentFilter"/>.
25+
/// Initializes an instance of <see cref="SimplifyWebDocumentFilter" />.
2526
/// </summary>
2627
/// <param name="args">The registration args</param>
2728
public SimplifyWebDocumentFilter(SimplifyWebSwaggerArgs? args) => _args = args;

src/Simplify.Web.Swagger/SimplifyWebSwaggerArgs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
namespace Simplify.Web.Swagger;
55

66
/// <summary>
7-
/// SimplifyWebSwagger registration args.
7+
/// Provides the SimplifyWeb Swagger registration args.
88
/// </summary>
99
public class SimplifyWebSwaggerArgs
1010
{
1111
/// <summary>
1212
/// Open Api Parameters
1313
/// </summary>
14-
public IList<OpenApiParameter> Parameters { get; } = new List<OpenApiParameter>();
14+
public IList<OpenApiParameter> Parameters { get; } = [];
1515
}

src/Simplify.Web.Swagger/SimplifyWebSwaggerExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
namespace Simplify.Web.Swagger;
55

66
/// <summary>
7-
/// Provides Swagger extensions for Simplify.Web
7+
/// Provides the Swagger extensions for Simplify.Web.
88
/// </summary>
99
public static class SimplifyWebSwaggerServiceCollectionExtensions
1010
{
1111
/// <summary>
1212
/// Add Simplify.Web controllers to Swagger documentation generation
1313
/// </summary>
14+
/// <param name="options">The options.</param>
15+
/// <param name="args">The arguments.</param>
1416
public static void AddSimplifyWebSwagger(this SwaggerGenOptions options, SimplifyWebSwaggerArgs? args = null)
1517
{
1618
if (args is null)

0 commit comments

Comments
 (0)