internal static ManifestAttributes DeserializeManifestAttributes(JsonElement element)
        {
            Optional <string> registry  = default;
            Optional <string> imageName = default;
            Optional <ManifestAttributesBase> manifest = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("registry"))
                {
                    registry = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("imageName"))
                {
                    imageName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("manifest"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    manifest = ManifestAttributesBase.DeserializeManifestAttributesBase(property.Value);
                    continue;
                }
            }
            return(new ManifestAttributes(registry.Value, imageName.Value, manifest.Value));
        }
コード例 #2
0
        internal static AcrManifests DeserializeAcrManifests(JsonElement element)
        {
            Optional <string> registry  = default;
            Optional <string> imageName = default;
            Optional <IReadOnlyList <ManifestAttributesBase> > manifests = default;
            Optional <string> link = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("registry"))
                {
                    registry = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("imageName"))
                {
                    imageName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("manifests"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ManifestAttributesBase> array = new List <ManifestAttributesBase>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ManifestAttributesBase.DeserializeManifestAttributesBase(item));
                    }
                    manifests = array;
                    continue;
                }
                if (property.NameEquals("link"))
                {
                    link = property.Value.GetString();
                    continue;
                }
            }
            return(new AcrManifests(registry.Value, imageName.Value, Optional.ToList(manifests), link.Value));
        }