private string ParseEnum(string key, Newtonsoft.JsonV4.Schema.JsonSchema schema, IDictionary <string, ApiEnum> enums, string description) { var name = NetNamingMapper.GetObjectName(key); var apiEnum = new ApiEnum { Name = name, Description = description, Values = schema.Enum.Select(e => NetNamingMapper.GetEnumValueName(e.ToString())).ToList() }; if (enums.ContainsKey(name)) { if (IsAlreadyAdded(enums, apiEnum)) { return(name); } apiEnum.Name = UniquenessHelper.GetUniqueName(enums, name); } enums.Add(apiEnum.Name, apiEnum); return(apiEnum.Name); }
private ApiEnum ParseEnum(ScalarShape scalar, IDictionary <string, ApiEnum> existingEnums, IDictionary <string, string> warnings, IDictionary <string, ApiEnum> newEnums) { return(new ApiEnum { Name = NetNamingMapper.GetObjectName(scalar.Name), Description = scalar.Description, Values = scalar.Values.Select(p => new PropertyBase { Name = NetNamingMapper.GetEnumValueName(p), OriginalName = p }).ToArray() }); }
public void Should_Not_Capitalize_Enum_Values() { Assert.AreEqual("i", NetNamingMapper.GetEnumValueName("i")); }