|
1 |
| -using System; |
2 | 1 | using System.Linq.Expressions;
|
3 | 2 |
|
4 |
| -namespace JsonApiDotNetCore.OpenApi.Client |
| 3 | +namespace JsonApiDotNetCore.OpenApi.Client; |
| 4 | + |
| 5 | +public interface IJsonApiClient |
5 | 6 | {
|
6 |
| - public interface IJsonApiClient |
7 |
| - { |
8 |
| - /// <summary> |
9 |
| - /// Ensures correct serialization of attributes in a POST/PATCH Resource request body. In JSON:API, an omitted attribute indicates to ignore it, while an |
10 |
| - /// attribute that is set to "null" means to clear it. This poses a problem because the serializer cannot distinguish between "you have explicitly set |
11 |
| - /// this .NET property to null" vs "you didn't touch it, so it is null by default" when converting an instance to JSON. Therefore, calling this method |
12 |
| - /// treats all attributes that contain their default value (<c>null</c> for reference types, <c>0</c> for integers, <c>false</c> for booleans, etc) as |
13 |
| - /// omitted unless explicitly listed to include them using <paramref name="alwaysIncludedAttributeSelectors" />. |
14 |
| - /// </summary> |
15 |
| - /// <param name="requestDocument"> |
16 |
| - /// The request document instance for which this registration applies. |
17 |
| - /// </param> |
18 |
| - /// <param name="alwaysIncludedAttributeSelectors"> |
19 |
| - /// Optional. A list of expressions to indicate which properties to unconditionally include in the JSON request body. For example: |
20 |
| - /// <code><![CDATA[ |
21 |
| - /// video => video.Title, video => video.Summary |
22 |
| - /// ]]></code> |
23 |
| - /// </param> |
24 |
| - /// <typeparam name="TRequestDocument"> |
25 |
| - /// The type of the request document. |
26 |
| - /// </typeparam> |
27 |
| - /// <typeparam name="TAttributesObject"> |
28 |
| - /// The type of the attributes object inside <typeparamref name="TRequestDocument" />. |
29 |
| - /// </typeparam> |
30 |
| - /// <returns> |
31 |
| - /// An <see cref="IDisposable" /> to clear the current registration. For efficient memory usage, it is recommended to wrap calls to this method in a |
32 |
| - /// <c>using</c> statement, so the registrations are cleaned up after executing the request. |
33 |
| - /// </returns> |
34 |
| - IDisposable RegisterAttributesForRequestDocument<TRequestDocument, TAttributesObject>(TRequestDocument requestDocument, |
35 |
| - params Expression<Func<TAttributesObject, object?>>[] alwaysIncludedAttributeSelectors) |
36 |
| - where TRequestDocument : class; |
37 |
| - } |
| 7 | + /// <summary> |
| 8 | + /// Ensures correct serialization of attributes in a POST/PATCH Resource request body. In JSON:API, an omitted attribute indicates to ignore it, while an |
| 9 | + /// attribute that is set to "null" means to clear it. This poses a problem because the serializer cannot distinguish between "you have explicitly set |
| 10 | + /// this .NET property to null" vs "you didn't touch it, so it is null by default" when converting an instance to JSON. Therefore, calling this method |
| 11 | + /// treats all attributes that contain their default value (<c>null</c> for reference types, <c>0</c> for integers, <c>false</c> for booleans, etc) as |
| 12 | + /// omitted unless explicitly listed to include them using <paramref name="alwaysIncludedAttributeSelectors" />. |
| 13 | + /// </summary> |
| 14 | + /// <param name="requestDocument"> |
| 15 | + /// The request document instance for which this registration applies. |
| 16 | + /// </param> |
| 17 | + /// <param name="alwaysIncludedAttributeSelectors"> |
| 18 | + /// Optional. A list of expressions to indicate which properties to unconditionally include in the JSON request body. For example: |
| 19 | + /// <code><![CDATA[ |
| 20 | + /// video => video.Title, video => video.Summary |
| 21 | + /// ]]></code> |
| 22 | + /// </param> |
| 23 | + /// <typeparam name="TRequestDocument"> |
| 24 | + /// The type of the request document. |
| 25 | + /// </typeparam> |
| 26 | + /// <typeparam name="TAttributesObject"> |
| 27 | + /// The type of the attributes object inside <typeparamref name="TRequestDocument" />. |
| 28 | + /// </typeparam> |
| 29 | + /// <returns> |
| 30 | + /// An <see cref="IDisposable" /> to clear the current registration. For efficient memory usage, it is recommended to wrap calls to this method in a |
| 31 | + /// <c>using</c> statement, so the registrations are cleaned up after executing the request. |
| 32 | + /// </returns> |
| 33 | + IDisposable RegisterAttributesForRequestDocument<TRequestDocument, TAttributesObject>(TRequestDocument requestDocument, |
| 34 | + params Expression<Func<TAttributesObject, object?>>[] alwaysIncludedAttributeSelectors) |
| 35 | + where TRequestDocument : class; |
38 | 36 | }
|
0 commit comments