private NormalizationApiModelEnum ParseEnumData(dynamic item) { dynamic model = item.Value; var normEnum = new NormalizationApiModelEnum { Name = (string)item.Key, }; if (model.ContainsKey("description") && !string.IsNullOrWhiteSpace((string)model.description)) { normEnum.Description = (string)model.description; } var type = new SimpleNormalizationApiDataType(model); type.TryParseEnumFromJObject(model); var values = type.EnumValues; if (values.Any()) { normEnum.Values.AddRange(values); } return(normEnum); }
private NormalizationApiModelEnum ParseEnumData(dynamic item) { var apiVersion = (string)item.ApiVersion; var resourceName = (string)item.ResourceName; var resourcePath = (string)item.ResourcePath; dynamic model = item.Model; var normEnum = new NormalizationApiModelEnum { ApiVersion = apiVersion, Name = (string)model.id, ResourceName = resourceName, ResourcePath = resourcePath }; if (model.ContainsKey("description") && !string.IsNullOrWhiteSpace((string)model.description)) { normEnum.Description = (string)model.description; } var type = new SimpleNormalizationApiDataType(model); type.TryParseEnumFromJObject(model); var values = type.EnumValues; if (values.Any()) { normEnum.Values.AddRange(values); } return(normEnum); }
private EnumDefinition CreateDefinition(NormalizationApiModelEnum normalEnum) { var ed = new EnumDefinition(normalEnum.AsMetadata()) { ContextName = "Enums", Description = normalEnum.Description, Name = normalEnum.Name.MapDataTypeName(), ResourceName = "Enums" }; for (var i = 0; i < normalEnum.Values.Count; i++) { var item = normalEnum.Values[i]; var idx = i; ed.Values.Add(item, idx); } return(ed); }
private NormalizationApiModelEnum ParseEnumData(dynamic item) { var apiVersion = (string) item.ApiVersion; var resourceName = (string) item.ResourceName; var resourcePath = (string) item.ResourcePath; dynamic model = item.Model; var normEnum = new NormalizationApiModelEnum { ApiVersion = apiVersion, Name = (string) model.id, ResourceName = resourceName, ResourcePath = resourcePath }; if (model.ContainsKey("description") && !string.IsNullOrWhiteSpace((string) model.description)) { normEnum.Description = (string) model.description; } var type = new SimpleNormalizationApiDataType(model); type.TryParseEnumFromJObject(model); var values = type.EnumValues; if (values.Any()) normEnum.Values.AddRange(values); return normEnum; }