Exemple #1
0
        internal static Operation DeserializeOperation(JsonElement element)
        {
            string           name    = default;
            OperationDisplay display = default;
            string           origin  = default;
            OperationPropertiesFormatServiceSpecification serviceSpecification = 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("display"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    display = OperationDisplay.DeserializeOperationDisplay(property.Value);
                    continue;
                }
                if (property.NameEquals("origin"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    origin = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("serviceSpecification"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            serviceSpecification = OperationPropertiesFormatServiceSpecification.DeserializeOperationPropertiesFormatServiceSpecification(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new Operation(name, display, origin, serviceSpecification));
        }
Exemple #2
0
        internal static Operation DeserializeOperation(JsonElement element)
        {
            Optional <string>           name    = default;
            Optional <OperationDisplay> display = default;
            Optional <string>           origin  = default;
            Optional <OperationPropertiesFormatServiceSpecification> serviceSpecification = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("display"))
                {
                    display = OperationDisplay.DeserializeOperationDisplay(property.Value);
                    continue;
                }
                if (property.NameEquals("origin"))
                {
                    origin = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("serviceSpecification"))
                        {
                            serviceSpecification = OperationPropertiesFormatServiceSpecification.DeserializeOperationPropertiesFormatServiceSpecification(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new Operation(name.Value, display.Value, origin.Value, serviceSpecification.Value));
        }