Skip to content

Commit

Permalink
Feature. Add Extensions property for ProblemDetails class (#57)
Browse files Browse the repository at this point in the history
Co-authored-by: Artem Levin <[email protected]>
  • Loading branch information
Leo506 and Artem Levin authored Sep 27, 2024
1 parent 02492b4 commit 4241165
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Arbus.Network/ProblemDetails.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Arbus.Network;
using System.Text.Json.Serialization;

namespace Arbus.Network;

/// <summary>
/// A machine-readable format for specifying errors in HTTP API responses based on <a href="https://tools.ietf.org/html/rfc7807">specification</a>.
Expand Down Expand Up @@ -30,4 +32,18 @@ public record ProblemDetails
/// or may not yield further information if dereferenced.
/// </summary>
public string? Instance { get; set; }

/// <summary>
/// Gets the <see cref="IDictionary{TKey, TValue}"/> for extension members.
/// <para>
/// Problem type definitions MAY extend the problem details object with additional members. Extension members appear in the same namespace as
/// other members of a problem type.
/// </para>
/// </summary>
/// <remarks>
/// The round-tripping behavior for <see cref="Extensions"/> is determined by the implementation of the Input \ Output formatters.
/// In particular, complex types or collection types may not round-trip to the original type when using the built-in JSON or XML formatters.
/// </remarks>
[JsonExtensionData]
public IDictionary<string, object?> Extensions { get; set; } = new Dictionary<string, object?>(StringComparer.Ordinal);
}

0 comments on commit 4241165

Please sign in to comment.