internal static Alias DeserializeAlias(JsonElement element)
        {
            Optional <string> name = default;
            Optional <IReadOnlyList <AliasPath> > paths = default;
            Optional <AliasType>    type           = default;
            Optional <string>       defaultPath    = default;
            Optional <AliasPattern> defaultPattern = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("paths"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <AliasPath> array = new List <AliasPath>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(AliasPath.DeserializeAliasPath(item));
                    }
                    paths = array;
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = property.Value.GetString().ToAliasType();
                    continue;
                }
                if (property.NameEquals("defaultPath"))
                {
                    defaultPath = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("defaultPattern"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    defaultPattern = AliasPattern.DeserializeAliasPattern(property.Value);
                    continue;
                }
            }
            return(new Alias(name.Value, Optional.ToList(paths), Optional.ToNullable(type), defaultPath.Value, defaultPattern.Value));
        }
        internal static Alias DeserializeAlias(JsonElement element)
        {
            string name = default;
            IReadOnlyList <AliasPath> paths = default;
            AliasType?   type           = default;
            string       defaultPath    = default;
            AliasPattern defaultPattern = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("paths"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <AliasPath> array = new List <AliasPath>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(AliasPath.DeserializeAliasPath(item));
                        }
                    }
                    paths = array;
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString().ToAliasType();
                    continue;
                }
                if (property.NameEquals("defaultPath"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    defaultPath = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("defaultPattern"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    defaultPattern = AliasPattern.DeserializeAliasPattern(property.Value);
                    continue;
                }
            }
            return(new Alias(name, paths, type, defaultPath, defaultPattern));
        }