Ejemplo n.º 1
0
 internal InnerErrorModel(InnerErrorCode code, string message, IDictionary <string, string> details, string target, InnerErrorModel innererror)
 {
     Code       = code;
     Message    = message;
     Details    = details;
     Target     = target;
     Innererror = innererror;
 }
Ejemplo n.º 2
0
        internal static Error DeserializeError(JsonElement element)
        {
            ErrorCode                    code                           = default;
            string                       message                        = default;
            Optional <string>            target                         = default;
            Optional <IList <Error> >    details                        = default;
            Optional <InnerErrorModel>   innererror                     = default;
            IDictionary <string, object> additionalProperties           = default;
            Dictionary <string, object>  additionalPropertiesDictionary = new Dictionary <string, object>();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("code"))
                {
                    code = new ErrorCode(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("message"))
                {
                    message = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("target"))
                {
                    target = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("details"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <Error> array = new List <Error>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DeserializeError(item));
                    }
                    details = array;
                    continue;
                }
                if (property.NameEquals("innererror"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    innererror = InnerErrorModel.DeserializeInnerErrorModel(property.Value);
                    continue;
                }
                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
            }
            additionalProperties = additionalPropertiesDictionary;
            return(new Error(code, message, target.Value, Optional.ToList(details), innererror.Value, additionalProperties));
        }
Ejemplo n.º 3
0
 internal Error(ErrorCode code, string message, string target, IList <Error> details, InnerErrorModel innererror, IDictionary <string, object> additionalProperties)
 {
     Code                 = code;
     Message              = message;
     Target               = target;
     Details              = details;
     Innererror           = innererror;
     AdditionalProperties = additionalProperties;
 }