| | 1 | | using Newtonsoft.Json.Linq; |
| | 2 | | using ValidateLib.ErrorsAndWarnings.Warnings; |
| | 3 | | using ValidateLib.Metadata.Descriptors; |
| | 4 | | using ValidateLib.Metadata.Properties; |
| | 5 | | using ValidateLib.Metadata.Validators; |
| | 6 | |
|
| | 7 | | namespace ValidateLib.Metadata.PropertyParsers |
| | 8 | | { |
| | 9 | |
|
| | 10 | | public class CommonPropertyParser : PropertyParserBase<CommonPropertiesDescriptor>, IPropertyParser<CommonProperties |
| | 11 | | { |
| 1 | 12 | | public CommonPropertyParser(List<Warning> warnings, CommonPropertiesDescriptor descriptor) : base(warnings, desc |
| | 13 | | { |
| 1 | 14 | | } |
| | 15 | | public void ParseProperty(JProperty property) |
| | 16 | | { |
| 1 | 17 | | if (property.Value.Type != JTokenType.Object && property.Value.Type != JTokenType.Array) |
| | 18 | | { |
| 0 | 19 | | Warnings.Add( |
| 0 | 20 | | WarningFactory.GetCommonPropertyWrongValueWarning(property.Value, property.Name)); |
| | 21 | | } |
| | 22 | | else |
| | 23 | | { |
| 1 | 24 | | var commonProperty = new CommonProperty(property.Name, property.Value); |
| 1 | 25 | | CommonPropertyValidator commonPropertyValidator = new CommonPropertyValidator(commonProperty); |
| 1 | 26 | | commonPropertyValidator.Validate(commonProperty); |
| 1 | 27 | | Descriptor.commonProperties.Add(commonProperty); |
| | 28 | |
|
| | 29 | | } |
| 1 | 30 | | } |
| | 31 | | } |
| | 32 | | } |