public PropertyDocumentation(ResourceKeyStack messagePath, PropertyInfo property) { _property = property; _messagePath = messagePath.BranchFor(property); IsRequired(property); DetermineDefault(property); Description = DescriptionAttribute.Harvest(property) ?? _messagePath.Description; _enumValues = GetEnumValues(_property.GetCustomAttribute <EnumProperyTypeAttribute>(false)?.EnumType); DataType = DetermineDataType(_property); Annotations = GetAnnotations(_property); var dateAttr = property.GetCustomAttribute <DatePropertyTypeAttribute>(); if (dateAttr != null) { DateFormat = dateAttr.Format; } }
public TagGroupDocumentation(ResourceKeyStack messagePath, ITagGroup tagGroup, IList <Func <ITag, TagDocumentation, bool> > specials, Dictionary <int, TagDocumentation> tagDictionary) { _messagePath = messagePath.BranchFor(tagGroup); _name = tagGroup.Name; _specials = specials; _tagDictionary = tagDictionary; _tags = new List <int>(); var tagGroupType = tagGroup.GetType(); _description = DescriptionAttribute.Harvest(tagGroupType) ?? _messagePath.Description; _title = TitleAttribute.HarvestTagLibrary(tagGroupType); foreach (ITag _tag in tagGroup) { var hash = _tag.GetType().GetHashCode(); if (!_tagDictionary.ContainsKey(hash)) { _tagDictionary[hash] = null; var tagDoc = new TagDocumentation(_messagePath, _tag, _specials, _tagDictionary); _tagDictionary[hash] = tagDoc; } _tags.Add(hash); } if (ExampleAttribute.Harvest(tagGroupType)) { _examples.AddRange(ExampleAttribute.HarvestTags(tagGroupType)); } if (HasExample.Has(tagGroupType)) { _examples.Add(new ExampleAttribute(_messagePath.Example)); } if (NoteAttribute.Harvest(tagGroupType)) { _notes.AddRange(NoteAttribute.HarvestTags(tagGroupType)); } if (HasNote.Has(tagGroupType)) { _notes.Add(new NoteAttribute(_messagePath.Note)); } }