private static ArrayType GetArray(IDictionary <string, object> dynamicRaml, string key) { var array = new ArrayType(); array.MaxItems = DynamicRamlParser.GetIntOrNull(dynamicRaml, "maxItems"); array.MinItems = DynamicRamlParser.GetIntOrNull(dynamicRaml, "minItems"); array.UniqueItems = DynamicRamlParser.GetBoolOrNull(dynamicRaml, "maxProperties"); RamlType items = null; if (dynamicRaml.ContainsKey("items")) { var asDictionary = dynamicRaml["items"] as IDictionary <string, object>; if (asDictionary != null) { items = GetRamlType(new KeyValuePair <string, object>("", asDictionary)); } else { var asString = dynamicRaml["items"] as string; items = new RamlType { Type = asString }; } } array.Items = items; return(array); }
private static ObjectType GetObject(IDictionary <string, object> dynamicRaml) { var obj = new ObjectType(); obj.AdditionalProperties = DynamicRamlParser.GetValueOrNull(dynamicRaml, "additionalProperties"); obj.Discriminator = DynamicRamlParser.GetValueOrNull(dynamicRaml, "discriminator"); obj.DiscriminatorValue = DynamicRamlParser.GetStringOrNull(dynamicRaml, "discriminatorValue"); obj.MaxProperties = DynamicRamlParser.GetIntOrNull(dynamicRaml, "maxProperties"); obj.MinProperties = DynamicRamlParser.GetIntOrNull(dynamicRaml, "minProperties"); obj.PatternProperties = DynamicRamlParser.GetValueOrNull(dynamicRaml, "patternProperties"); ParseProperties(dynamicRaml, obj); return(obj); }
private static ObjectType GetObject(IDictionary <string, object> dynamicRaml) { var obj = new ObjectType(); obj.AdditionalProperties = DynamicRamlParser.GetValueOrNull(dynamicRaml, "additionalProperties"); obj.Discriminator = DynamicRamlParser.GetValueOrNull(dynamicRaml, "discriminator"); obj.DiscriminatorValue = DynamicRamlParser.GetStringOrNull(dynamicRaml, "discriminatorValue"); obj.MaxProperties = DynamicRamlParser.GetIntOrNull(dynamicRaml, "maxProperties"); obj.MinProperties = DynamicRamlParser.GetIntOrNull(dynamicRaml, "minProperties"); obj.PatternProperties = DynamicRamlParser.GetValueOrNull(dynamicRaml, "patternProperties"); var properties = new Dictionary <string, RamlType>(); if (dynamicRaml.ContainsKey("properties")) { foreach (var property in (IDictionary <string, object>)dynamicRaml["properties"]) { properties.Add(property.Key, GetRamlType(property)); } } obj.Properties = properties; return(obj); }