Skip to content

Commit a051fa9

Browse files
committed
Fixes to doc-comments to improve layout of generated API documentation
1 parent 4962e90 commit a051fa9

5 files changed

Lines changed: 35 additions & 31 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ 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[
11+
/// <example>
12+
/// <code><![CDATA[
1213
/// public class User : Identifiable
1314
/// {
1415
/// [Attr(AttrCapabilities.AllowFilter | AttrCapabilities.AllowSort)]
@@ -30,7 +31,8 @@ namespace JsonApiDotNetCore.Resources.Annotations;
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/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/BaseJsonApiController.cs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected BaseJsonApiController(IJsonApiOptions options, IResourceGraph resource
8686
}
8787

8888
/// <summary>
89-
/// Gets a collection of primary resources. Example: <code><![CDATA[
89+
/// Gets a collection of primary resources. Example request: <code language="http"><![CDATA[
9090
/// GET /articles HTTP/1.1
9191
/// ]]></code>
9292
/// </summary>
@@ -105,7 +105,7 @@ public virtual async Task<IActionResult> GetAsync(CancellationToken cancellation
105105
}
106106

107107
/// <summary>
108-
/// Gets a single primary resource by ID. Example: <code><![CDATA[
108+
/// Gets a single primary resource by ID. Example request: <code language="http"><![CDATA[
109109
/// GET /articles/1 HTTP/1.1
110110
/// ]]></code>
111111
/// </summary>
@@ -127,10 +127,11 @@ public virtual async Task<IActionResult> GetAsync([DisallowNull] TId id, Cancell
127127
}
128128

129129
/// <summary>
130-
/// Gets a secondary resource or collection of secondary resources. Example: <code><![CDATA[
130+
/// Gets a secondary resource or collection of secondary resources. Example request:
131+
/// <code language="http"><![CDATA[
131132
/// GET /articles/1/author HTTP/1.1
132-
/// ]]></code> Example:
133-
/// <code><![CDATA[
133+
/// ]]></code> Example request:
134+
/// <code language="http"><![CDATA[
134135
/// GET /articles/1/revisions HTTP/1.1
135136
/// ]]></code>
136137
/// </summary>
@@ -156,11 +157,11 @@ public virtual async Task<IActionResult> GetSecondaryAsync([DisallowNull] TId id
156157
}
157158

158159
/// <summary>
159-
/// Gets a relationship value, which can be a <c>null</c>, a single object or a collection. Example:
160-
/// <code><![CDATA[
160+
/// Gets a relationship value, which can be a <c>null</c>, a single object or a collection. Example request:
161+
/// <code language="http"><![CDATA[
161162
/// GET /articles/1/relationships/author HTTP/1.1
162-
/// ]]></code> Example:
163-
/// <code><![CDATA[
163+
/// ]]></code> Example request:
164+
/// <code language="http"><![CDATA[
164165
/// GET /articles/1/relationships/revisions HTTP/1.1
165166
/// ]]></code>
166167
/// </summary>
@@ -186,7 +187,7 @@ public virtual async Task<IActionResult> GetRelationshipAsync([DisallowNull] TId
186187
}
187188

188189
/// <summary>
189-
/// Creates a new resource with attributes, relationships or both. Example: <code><![CDATA[
190+
/// Creates a new resource with attributes, relationships or both. Example request: <code language="http"><![CDATA[
190191
/// POST /articles HTTP/1.1
191192
/// ]]></code>
192193
/// </summary>
@@ -233,7 +234,7 @@ private string GetLocationUrl(string resourceId)
233234
}
234235

235236
/// <summary>
236-
/// Adds resources to a to-many relationship. Example: <code><![CDATA[
237+
/// Adds resources to a to-many relationship. Example request: <code language="http"><![CDATA[
237238
/// POST /articles/1/revisions HTTP/1.1
238239
/// ]]></code>
239240
/// </summary>
@@ -274,7 +275,7 @@ public virtual async Task<IActionResult> PostRelationshipAsync([DisallowNull] TI
274275

275276
/// <summary>
276277
/// Updates the attributes and/or relationships of an existing resource. Only the values of sent attributes are replaced. And only the values of sent
277-
/// relationships are replaced. Example: <code><![CDATA[
278+
/// relationships are replaced. Example request: <code language="http"><![CDATA[
278279
/// PATCH /articles/1 HTTP/1.1
279280
/// ]]></code>
280281
/// </summary>
@@ -304,11 +305,11 @@ public virtual async Task<IActionResult> PatchAsync([DisallowNull] TId id, [From
304305
}
305306

306307
/// <summary>
307-
/// Performs a complete replacement of a relationship on an existing resource. Example:
308-
/// <code><![CDATA[
308+
/// Performs a complete replacement of a relationship on an existing resource. Example request:
309+
/// <code language="http"><![CDATA[
309310
/// PATCH /articles/1/relationships/author HTTP/1.1
310-
/// ]]></code> Example:
311-
/// <code><![CDATA[
311+
/// ]]></code> Example request:
312+
/// <code language="http"><![CDATA[
312313
/// PATCH /articles/1/relationships/revisions HTTP/1.1
313314
/// ]]></code>
314315
/// </summary>
@@ -347,7 +348,7 @@ public virtual async Task<IActionResult> PatchRelationshipAsync([DisallowNull] T
347348
}
348349

349350
/// <summary>
350-
/// Deletes an existing resource. Example: <code><![CDATA[
351+
/// Deletes an existing resource. Example request: <code language="http"><![CDATA[
351352
/// DELETE /articles/1 HTTP/1.1
352353
/// ]]></code>
353354
/// </summary>
@@ -369,7 +370,8 @@ public virtual async Task<IActionResult> DeleteAsync([DisallowNull] TId id, Canc
369370
}
370371

371372
/// <summary>
372-
/// Removes resources from a to-many relationship. Example: <code><![CDATA[
373+
/// Removes resources from a to-many relationship. Example request:
374+
/// <code language="http"><![CDATA[
373375
/// DELETE /articles/1/relationships/revisions HTTP/1.1
374376
/// ]]></code>
375377
/// </summary>

src/JsonApiDotNetCore/Controllers/BaseJsonApiOperationsController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ protected BaseJsonApiOperationsController(IJsonApiOptions options, IResourceGrap
5252
/// none of the operations returns any data, then HTTP 201 is returned instead of 200.
5353
/// </summary>
5454
/// <example>
55-
/// The next example creates a new resource.
56-
/// <code><![CDATA[
55+
/// The following example creates a new resource.
56+
/// <code language="http"><![CDATA[
5757
/// POST /operations HTTP/1.1
5858
/// Content-Type: application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"
5959
///
@@ -71,8 +71,8 @@ protected BaseJsonApiOperationsController(IJsonApiOptions options, IResourceGrap
7171
/// ]]></code>
7272
/// </example>
7373
/// <example>
74-
/// The next example updates an existing resource.
75-
/// <code><![CDATA[
74+
/// The following example updates an existing resource.
75+
/// <code language="http"><![CDATA[
7676
/// POST /operations HTTP/1.1
7777
/// Content-Type: application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"
7878
///
@@ -91,8 +91,8 @@ protected BaseJsonApiOperationsController(IJsonApiOptions options, IResourceGrap
9191
/// ]]></code>
9292
/// </example>
9393
/// <example>
94-
/// The next example deletes an existing resource.
95-
/// <code><![CDATA[
94+
/// The following example deletes an existing resource.
95+
/// <code language="http"><![CDATA[
9696
/// POST /operations HTTP/1.1
9797
/// Content-Type: application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"
9898
///

0 commit comments

Comments
 (0)