From 4241165b6828809778bda6bf8e64631fe677f99e Mon Sep 17 00:00:00 2001 From: Artem Levin <64748654+Leo506@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:19:00 +0500 Subject: [PATCH] Feature. Add Extensions property for ProblemDetails class (#57) Co-authored-by: Artem Levin --- src/Arbus.Network/ProblemDetails.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Arbus.Network/ProblemDetails.cs b/src/Arbus.Network/ProblemDetails.cs index 02146dc..4ad11b4 100644 --- a/src/Arbus.Network/ProblemDetails.cs +++ b/src/Arbus.Network/ProblemDetails.cs @@ -1,4 +1,6 @@ -namespace Arbus.Network; +using System.Text.Json.Serialization; + +namespace Arbus.Network; /// /// A machine-readable format for specifying errors in HTTP API responses based on specification. @@ -30,4 +32,18 @@ public record ProblemDetails /// or may not yield further information if dereferenced. /// public string? Instance { get; set; } + + /// + /// Gets the for extension members. + /// + /// 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. + /// + /// + /// + /// The round-tripping behavior for 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. + /// + [JsonExtensionData] + public IDictionary Extensions { get; set; } = new Dictionary(StringComparer.Ordinal); } \ No newline at end of file