Skip to content

Commit 7364e94

Browse files
authored
Merge pull request #1244 from json-api-dotnet/openapi-nrt-msv-updates
OpenAPI NRT/MSV updates
2 parents 3e9708a + 2d7f8b9 commit 7364e94

File tree

70 files changed

+2923
-2907
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2923
-2907
lines changed

src/JsonApiDotNetCore.OpenApi.Client/IJsonApiClient.cs

+8-10
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,19 @@ namespace JsonApiDotNetCore.OpenApi.Client;
55
public interface IJsonApiClient
66
{
77
/// <summary>
8+
/// Ensures correct serialization of JSON:API attributes in the request body of a POST/PATCH request at a resource endpoint. Properties with default
9+
/// values are omitted, unless explicitly included using <paramref name="alwaysIncludedAttributeSelectors" />
810
/// <para>
9-
/// Calling this method ensures that attributes containing a default value (<c>null</c> for reference types, <c>0</c> for integers, <c>false</c> for
10-
/// booleans, etc) are omitted during serialization, except for those explicitly marked for inclusion in
11-
/// <paramref name="alwaysIncludedAttributeSelectors" />.
12-
/// </para>
13-
/// <para>
14-
/// This is sometimes required to ensure correct serialization of attributes during a POST/PATCH request. In JSON:API, an omitted attribute indicates to
15-
/// ignore it, while an attribute that is set to "null" means to clear it. This poses a problem because the serializer cannot distinguish between "you
16-
/// have explicitly set this .NET property to null" vs "you didn't touch it, so it is null by default" when converting an instance to JSON.
11+
/// In JSON:API, an omitted attribute indicates to ignore it, while an attribute that is set to <c>null</c> means to clear it. This poses a problem,
12+
/// because the serializer cannot distinguish between "you have explicitly set this .NET property to its default value" vs "you didn't touch it, so it
13+
/// contains its default value" when converting to JSON.
1714
/// </para>
1815
/// </summary>
1916
/// <param name="requestDocument">
2017
/// The request document instance for which default values should be omitted.
2118
/// </param>
2219
/// <param name="alwaysIncludedAttributeSelectors">
23-
/// Optional. A list of expressions to indicate which properties to unconditionally include in the JSON request body. For example:
20+
/// Optional. A list of lambda expressions that indicate which properties to always include in the JSON request body. For example:
2421
/// <code><![CDATA[
2522
/// video => video.Title, video => video.Summary
2623
/// ]]></code>
@@ -33,7 +30,8 @@ public interface IJsonApiClient
3330
/// </typeparam>
3431
/// <returns>
3532
/// An <see cref="IDisposable" /> to clear the current registration. For efficient memory usage, it is recommended to wrap calls to this method in a
36-
/// <c>using</c> statement, so the registrations are cleaned up after executing the request.
33+
/// <c>using</c> statement, so the registrations are cleaned up after executing the request. After disposal, the client can be reused without the
34+
/// registrations added earlier.
3735
/// </returns>
3836
IDisposable WithPartialAttributeSerialization<TRequestDocument, TAttributesObject>(TRequestDocument requestDocument,
3937
params Expression<Func<TAttributesObject, object?>>[] alwaysIncludedAttributeSelectors)

0 commit comments

Comments
 (0)