internal TabularTranslator(string type, IDictionary <string, object> additionalProperties, object columnMappings, object schemaMapping, object collectionReference, object mapComplexValuesToString, object mappings, object typeConversion, TypeConversionSettings typeConversionSettings) : base(type, additionalProperties)
 {
     ColumnMappings           = columnMappings;
     SchemaMapping            = schemaMapping;
     CollectionReference      = collectionReference;
     MapComplexValuesToString = mapComplexValuesToString;
     Mappings               = mappings;
     TypeConversion         = typeConversion;
     TypeConversionSettings = typeConversionSettings;
     Type = type ?? "TabularTranslator";
 }
Example #2
0
        internal static TabularTranslator DeserializeTabularTranslator(JsonElement element)
        {
            Optional <object> columnMappings           = default;
            Optional <object> schemaMapping            = default;
            Optional <object> collectionReference      = default;
            Optional <object> mapComplexValuesToString = default;
            Optional <object> mappings       = default;
            Optional <object> typeConversion = default;
            Optional <TypeConversionSettings> typeConversionSettings = default;
            string type = default;
            IDictionary <string, object> additionalProperties           = default;
            Dictionary <string, object>  additionalPropertiesDictionary = new Dictionary <string, object>();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("columnMappings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    columnMappings = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("schemaMapping"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    schemaMapping = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("collectionReference"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    collectionReference = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("mapComplexValuesToString"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    mapComplexValuesToString = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("mappings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    mappings = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("typeConversion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    typeConversion = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("typeConversionSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    typeConversionSettings = TypeConversionSettings.DeserializeTypeConversionSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
            }
            additionalProperties = additionalPropertiesDictionary;
            return(new TabularTranslator(type, additionalProperties, columnMappings.Value, schemaMapping.Value, collectionReference.Value, mapComplexValuesToString.Value, mappings.Value, typeConversion.Value, typeConversionSettings.Value));
        }