Skip to content

Commit e527f15

Browse files
Add XML documentation
Add XML documentation for the Swashbuckle.AspNetCore.Newtonsoft package.
1 parent 82a6933 commit e527f15

4 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/Swashbuckle.AspNetCore.Newtonsoft/DependencyInjection/NewtonsoftServiceCollectionExtensions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@
66

77
namespace Microsoft.Extensions.DependencyInjection;
88

9+
/// <summary>
10+
/// A class containing extension methods for setting up Newtonsoft.Json support. This class cannot be inherited.
11+
/// </summary>
912
public static class NewtonsoftServiceCollectionExtensions
1013
{
14+
/// <summary>
15+
/// Add support for using Newtonsoft.Json for serializing OpenAPI documents.
16+
/// </summary>
17+
/// <param name="services">The <see cref="IServiceCollection"/> to configure.</param>
18+
/// <returns>
19+
/// The <see cref="IServiceCollection"/> so that additional calls can be chained.
20+
/// </returns>
1121
public static IServiceCollection AddSwaggerGenNewtonsoftSupport(this IServiceCollection services)
1222
{
1323
return services.Replace(

src/Swashbuckle.AspNetCore.Newtonsoft/SchemaGenerator/JsonPropertyExtensions.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,19 @@
44

55
namespace Swashbuckle.AspNetCore.Newtonsoft;
66

7+
/// <summary>
8+
/// A class containing extension methods for the <see cref="JsonProperty"/> class. This class cannot be inherited.
9+
/// </summary>
710
public static class JsonPropertyExtensions
811
{
12+
/// <summary>
13+
/// Tries to get the <see cref="MemberInfo"/> for the given <see cref="JsonProperty"/>.
14+
/// </summary>
15+
/// <param name="jsonProperty">The <see cref="JsonProperty"/> to get the <see cref="MemberInfo"/> for.</param>
16+
/// <param name="memberInfo">When the method returns, contains the <see cref="MemberInfo"/> for the property, if found.</param>
17+
/// <returns>
18+
/// <see langword="true"/> if the <see cref="MemberInfo"/> was found; otherwise, <see langword="false"/>.
19+
/// </returns>
920
public static bool TryGetMemberInfo(this JsonProperty jsonProperty, out MemberInfo memberInfo)
1021
{
1122
memberInfo = jsonProperty.DeclaringType?
@@ -15,6 +26,13 @@ public static bool TryGetMemberInfo(this JsonProperty jsonProperty, out MemberIn
1526
return memberInfo != null;
1627
}
1728

29+
/// <summary>
30+
/// Returns whether the specified <see cref="JsonProperty"/> is specified whether it is required.
31+
/// </summary>
32+
/// <param name="jsonProperty">The <see cref="JsonProperty"/> to test.</param>
33+
/// <returns>
34+
/// <see langword="true"/> if the <see cref="JsonProperty"/> specifies whether it is required; otherwise, <see langword="false"/>.
35+
/// </returns>
1836
public static bool IsRequiredSpecified(this JsonProperty jsonProperty)
1937
=> jsonProperty.Required != Required.Default;
2038
}

src/Swashbuckle.AspNetCore.Newtonsoft/SchemaGenerator/NewtonsoftDataContractResolver.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@
77

88
namespace Swashbuckle.AspNetCore.Newtonsoft;
99

10+
/// <summary>
11+
/// A class representing an <see cref="ISerializerDataContractResolver"/> implementation that uses Newtonsoft.Json.
12+
/// </summary>
13+
/// <param name="serializerSettings">The <see cref="JsonSerializerSettings"/> to use.</param>
1014
public class NewtonsoftDataContractResolver(JsonSerializerSettings serializerSettings) : ISerializerDataContractResolver
1115
{
1216
private readonly JsonSerializerSettings _serializerSettings = serializerSettings;
1317
private readonly IContractResolver _contractResolver = serializerSettings.ContractResolver ?? new DefaultContractResolver();
1418

19+
/// <inheritdoc/>
1520
public DataContract GetDataContractForType(Type type)
1621
{
1722
var effectiveType = Nullable.GetUnderlyingType(type) ?? type;

src/Swashbuckle.AspNetCore.Newtonsoft/Swashbuckle.AspNetCore.Newtonsoft.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<AssemblyOriginatorKeyFile>Swashbuckle.AspNetCore.Newtonsoft.snk</AssemblyOriginatorKeyFile>
55
<Description>Swagger Generator opt-in component to support Newtonsoft.Json serializer behaviors</Description>
6+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
67
<IsPackable>true</IsPackable>
78
<PackageTags>swagger;openapi;documentation;discovery;help;webapi;aspnet;aspnetcore;newtonsoft</PackageTags>
89
<SignAssembly>true</SignAssembly>

0 commit comments

Comments
 (0)