Skip to content

OpenAPI NRT/MSV updates #1244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8304c05
Make AutoFakers deterministic; generate positive IDs
bkoelman Jan 7, 2023
9672b14
Fix nameof
bkoelman Jan 7, 2023
345a689
Use On/Off naming, shorten type names by using Nrt+Msv
bkoelman Jan 7, 2023
22ad300
Renamed EmptyResource to Empty to further shorten FK names
bkoelman Jan 7, 2023
3069533
Fixed invalid EF Core mappings, resulting in logged warnings and inab…
bkoelman Jan 7, 2023
36ac8e7
Move misplaced Act comments
bkoelman Jan 7, 2023
a88bce8
Optimize and clarify ResourceFieldValidationMetadataProvider
bkoelman Jan 8, 2023
2652063
Rename method, provide error message
bkoelman Jan 8, 2023
f2ecb5f
Refactor JsonApiClient: simplified recursion by using two converters,…
bkoelman Jan 8, 2023
d337230
Add relationship nullability assertions in OpenAPI client tests
bkoelman Jan 8, 2023
52cc1f1
Cleanup JsonElementExtensions
bkoelman Jan 8, 2023
b30a680
Cleanup ObjectExtensions
bkoelman Jan 8, 2023
73c3232
Make base type abstract, remove redundant TranslateAsync calls, inlin…
bkoelman Jan 8, 2023
55e702c
Simplify usings
bkoelman Jan 9, 2023
28bb39b
Sync up test names
bkoelman Jan 9, 2023
ff4262e
Fix invalid tests
bkoelman Jan 9, 2023
821d09d
Fix assertion messages
bkoelman Jan 9, 2023
5b71d90
Sync up tests
bkoelman Jan 9, 2023
df9a1b4
Revert change to pass full options instead of just the naming policy
bkoelman Jan 9, 2023
9844e6a
Fix casing in test names
bkoelman Jan 10, 2023
6071f5b
Simplify Cannot_exclude_Id tests
bkoelman Jan 10, 2023
6881208
Rename base type to avoid OpenApiClientTests.OpenApiClientTests
bkoelman Jan 10, 2023
cc3815c
Adapt to existing naming convention
bkoelman Sep 30, 2023
4ef8214
Remove redundant assertions, fix formatting
bkoelman Sep 30, 2023
dcdf5a5
Correct test names
bkoelman Sep 30, 2023
2d7f8b9
Centralize code for property assignment in tests
bkoelman Oct 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions src/JsonApiDotNetCore.OpenApi.Client/IJsonApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,19 @@ namespace JsonApiDotNetCore.OpenApi.Client;
public interface IJsonApiClient
{
/// <summary>
/// Ensures correct serialization of JSON:API attributes in the request body of a POST/PATCH request at a resource endpoint. Properties with default
/// values are omitted, unless explicitly included using <paramref name="alwaysIncludedAttributeSelectors" />
/// <para>
/// 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
/// booleans, etc) are omitted during serialization, except for those explicitly marked for inclusion in
/// <paramref name="alwaysIncludedAttributeSelectors" />.
/// </para>
/// <para>
/// This is sometimes required to ensure correct serialization of attributes during a POST/PATCH request. In JSON:API, an omitted attribute indicates to
/// 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
/// 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.
/// 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,
/// 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
/// contains its default value" when converting to JSON.
/// </para>
/// </summary>
/// <param name="requestDocument">
/// The request document instance for which default values should be omitted.
/// </param>
/// <param name="alwaysIncludedAttributeSelectors">
/// Optional. A list of expressions to indicate which properties to unconditionally include in the JSON request body. For example:
/// Optional. A list of lambda expressions that indicate which properties to always include in the JSON request body. For example:
/// <code><![CDATA[
/// video => video.Title, video => video.Summary
/// ]]></code>
Expand All @@ -33,7 +30,8 @@ public interface IJsonApiClient
/// </typeparam>
/// <returns>
/// An <see cref="IDisposable" /> to clear the current registration. For efficient memory usage, it is recommended to wrap calls to this method in a
/// <c>using</c> statement, so the registrations are cleaned up after executing the request.
/// <c>using</c> statement, so the registrations are cleaned up after executing the request. After disposal, the client can be reused without the
/// registrations added earlier.
/// </returns>
IDisposable WithPartialAttributeSerialization<TRequestDocument, TAttributesObject>(TRequestDocument requestDocument,
params Expression<Func<TAttributesObject, object?>>[] alwaysIncludedAttributeSelectors)
Expand Down
Loading