Skip to content

Commit ae82a95

Browse files
authored
Fixes to doc-comments to improve layout of generated API documentation (#1902)
* Fixes to doc-comments to improve layout of generated API documentation * Update links
1 parent 4962e90 commit ae82a95

File tree

14 files changed

+90
-55
lines changed

14 files changed

+90
-55
lines changed

src/Examples/NoEntityFrameworkExample/NullSafeExpressionRewriter.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ namespace NoEntityFrameworkExample;
66
/// <summary>
77
/// Inserts a null check on member dereference and extension method invocation, to prevent a <see cref="NullReferenceException" /> from being thrown when
88
/// the expression is compiled and executed.
9-
/// </summary>
10-
/// For example,
11-
/// <code><![CDATA[
9+
/// <example>
10+
/// For example, <code><![CDATA[
1211
/// Database.TodoItems.Where(todoItem => todoItem.Assignee.Id == todoItem.Owner.Id)
13-
/// ]]> </code>
14-
/// would throw if the database contains a
15-
/// TodoItem that doesn't have an assignee.
16-
/// <example></example>
12+
/// ]]></code> would throw if the database
13+
/// contains a TodoItem that doesn't have an assignee.
14+
/// </example>
15+
/// </summary>
1716
public sealed class NullSafeExpressionRewriter : ExpressionVisitor
1817
{
1918
private const string MinValueName = nameof(long.MinValue);

src/JsonApiDotNetCore.Annotations/Configuration/ResourceType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ private static IReadOnlySet<AttrAttribute> GetAttributesInTypeOrDerived(Resource
289289
}
290290

291291
// Hiding base members using the 'new' keyword instead of 'override' (effectively breaking inheritance) is currently not supported.
292-
// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/knowing-when-to-use-override-and-new-keywords
292+
// https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/knowing-when-to-use-override-and-new-keywords
293293
HashSet<AttrAttribute> attributesInDerivedTypes = [];
294294

295295
foreach (AttrAttribute attributeInDerivedType in resourceType.DirectlyDerivedTypes
@@ -330,7 +330,7 @@ private static IReadOnlySet<RelationshipAttribute> GetRelationshipsInTypeOrDeriv
330330
}
331331

332332
// Hiding base members using the 'new' keyword instead of 'override' (effectively breaking inheritance) is currently not supported.
333-
// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/knowing-when-to-use-override-and-new-keywords
333+
// https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/knowing-when-to-use-override-and-new-keywords
334334
HashSet<RelationshipAttribute> relationshipsInDerivedTypes = [];
335335

336336
foreach (RelationshipAttribute relationshipInDerivedType in resourceType.DirectlyDerivedTypes

src/JsonApiDotNetCore.Annotations/Resources/Annotations/EagerLoadAttribute.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ namespace JsonApiDotNetCore.Resources.Annotations;
88
/// </summary>
99
/// <remarks>
1010
/// This is intended for calculated properties that are exposed as JSON:API attributes, which depend on a related entity to always be loaded.
11-
/// <example><![CDATA[
12-
/// public class User : Identifiable
11+
/// <example>
12+
/// <code><![CDATA[
13+
/// public class User : Identifiable<long>
1314
/// {
1415
/// [Attr(AttrCapabilities.AllowFilter | AttrCapabilities.AllowSort)]
1516
/// [NotMapped]
@@ -25,12 +26,13 @@ namespace JsonApiDotNetCore.Resources.Annotations;
2526
/// public string Last { get; set; }
2627
/// }
2728
///
28-
/// public class Blog : Identifiable
29+
/// public class Blog : Identifiable<long>
2930
/// {
3031
/// [HasOne]
3132
/// public User Author { get; set; }
3233
/// }
33-
/// ]]></example>
34+
/// ]]></code>
35+
/// </example>
3436
/// </remarks>
3537
[PublicAPI]
3638
[AttributeUsage(AttributeTargets.Property)]

src/JsonApiDotNetCore.Annotations/Resources/Annotations/HasManyAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace JsonApiDotNetCore.Resources.Annotations;
1111
/// </summary>
1212
/// <example>
1313
/// <code><![CDATA[
14-
/// public class Author : Identifiable
14+
/// public class Author : Identifiable<long>
1515
/// {
1616
/// [HasMany]
1717
/// public ISet<Article> Articles { get; set; }

src/JsonApiDotNetCore.Annotations/Resources/Annotations/HasOneAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace JsonApiDotNetCore.Resources.Annotations;
99
/// </summary>
1010
/// <example>
1111
/// <code><![CDATA[
12-
/// public class Article : Identifiable
12+
/// public class Article : Identifiable<long>
1313
/// {
1414
/// [HasOne]
1515
/// public Author Author { get; set; }

src/JsonApiDotNetCore.Annotations/Resources/Annotations/RelationshipAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public abstract class RelationshipAttribute : ResourceFieldAttribute
2525
/// </summary>
2626
/// <example>
2727
/// <code><![CDATA[
28-
/// public class Article : Identifiable
28+
/// public class Article : Identifiable<long>
2929
/// {
3030
/// [HasOne] // InverseNavigationProperty: Person.Articles
3131
/// public Person Owner { get; set; }
3232
/// }
3333
///
34-
/// public class Person : Identifiable
34+
/// public class Person : Identifiable<long>
3535
/// {
3636
/// [HasMany] // InverseNavigationProperty: Article.Owner
3737
/// public ICollection<Article> Articles { get; set; }

src/JsonApiDotNetCore.Annotations/Resources/RuntimeTypeConverter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,12 @@ public static bool CanContainNull(Type type)
167167

168168
/// <summary>
169169
/// Gets the name of a type, including the names of its generic type arguments, without any namespaces.
170-
/// <example>
171-
/// <code><![CDATA[
170+
/// </summary>
171+
/// <returns>
172+
/// Example return value: <code><![CDATA[
172173
/// KeyValuePair<TimeSpan, Nullable<DateTimeOffset>>
173174
/// ]]></code>
174-
/// </example>
175-
/// </summary>
175+
/// </returns>
176176
public static string GetFriendlyTypeName(Type type)
177177
{
178178
ArgumentNullException.ThrowIfNull(type);

src/JsonApiDotNetCore/Configuration/IJsonApiOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public interface IJsonApiOptions
191191
/// Enables to customize the settings that are used by the <see cref="JsonSerializer" />.
192192
/// </summary>
193193
/// <example>
194-
/// The next example sets the naming convention to camel casing.
194+
/// The following example sets the naming convention to camel casing.
195195
/// <code><![CDATA[
196196
/// options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
197197
/// options.SerializerOptions.DictionaryKeyPolicy = JsonNamingPolicy.CamelCase;

src/JsonApiDotNetCore/Controllers/Annotations/DisableQueryStringAttribute.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ namespace JsonApiDotNetCore.Controllers.Annotations;
66
/// <summary>
77
/// Used on an ASP.NET controller class to indicate which query string parameters are blocked.
88
/// </summary>
9-
/// <example><![CDATA[
9+
/// <example>
10+
/// <code><![CDATA[
1011
/// [DisableQueryString(JsonApiQueryStringParameters.Sort | JsonApiQueryStringParameters.Page)]
1112
/// public class CustomersController : JsonApiController<Customer> { }
12-
/// ]]></example>
13-
/// <example><![CDATA[
13+
/// ]]></code>
14+
/// <code><![CDATA[
1415
/// [DisableQueryString("skipCache")]
1516
/// public class CustomersController : JsonApiController<Customer> { }
16-
/// ]]></example>
17+
/// ]]></code>
18+
/// </example>
1719
[PublicAPI]
1820
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
1921
public sealed class DisableQueryStringAttribute : Attribute

src/JsonApiDotNetCore/Controllers/Annotations/DisableRoutingConventionAttribute.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ namespace JsonApiDotNetCore.Controllers.Annotations;
55
/// <summary>
66
/// Used on an ASP.NET controller class to indicate that a custom route is used instead of the built-in routing convention.
77
/// </summary>
8-
/// <example><![CDATA[
8+
/// <example>
9+
/// <code><![CDATA[
910
/// [DisableRoutingConvention, Route("some/custom/route/to/customers")]
1011
/// public class CustomersController : JsonApiController<Customer> { }
11-
/// ]]></example>
12+
/// ]]></code>
13+
/// </example>
1214
[PublicAPI]
1315
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
1416
public sealed class DisableRoutingConventionAttribute : Attribute;

0 commit comments

Comments
 (0)