| | 1 | | using Newtonsoft.Json.Linq; |
| | 2 | | using ValidateLib.ErrorsAndWarnings.Warnings; |
| | 3 | | using ValidateLib.Metadata.Descriptors; |
| | 4 | | using ValidateLib.Metadata.Properties.AtomicProperties; |
| | 5 | |
|
| | 6 | | namespace ValidateLib.Metadata.PropertyParsers.InheritedProperties |
| | 7 | | { |
| | 8 | | internal class NullPropertyParser : PropertyParserBase<InheritedPropertiesDescriptor>, IPropertyParser<InheritedProp |
| | 9 | | { |
| 1 | 10 | | public NullPropertyParser(List<Warning> warnings, InheritedPropertiesDescriptor descriptor) : base(warnings, des |
| | 11 | | { |
| 1 | 12 | | } |
| | 13 | |
|
| | 14 | | public void ParseProperty(JProperty property) |
| | 15 | | { |
| 1 | 16 | | if (property.Value.Type == JTokenType.String) |
| | 17 | | { |
| 1 | 18 | | Descriptor._null = new AtomicPropertyArray<string>(new List<string>() { property.Value.ToString() }); |
| | 19 | | } |
| 1 | 20 | | else if (property.Value.Type == JTokenType.Array) |
| | 21 | | { |
| 1 | 22 | | List<string> nullValues = new List<string>(); |
| 1 | 23 | | foreach (var value in property.Value) |
| | 24 | | { |
| 1 | 25 | | if (value.Type == JTokenType.String) |
| | 26 | | { |
| 1 | 27 | | nullValues.Add(value.ToString()); |
| | 28 | | } |
| | 29 | | else |
| | 30 | | { |
| 1 | 31 | | Warnings.Add(WarningFactory.GetStringPropertyWrongValueWarning(property.Value, property.Name, pr |
| | 32 | | } |
| | 33 | | } |
| 1 | 34 | | Descriptor._null = new AtomicPropertyArray<string>(nullValues); |
| | 35 | | } |
| | 36 | | else |
| | 37 | | { |
| 1 | 38 | | Warnings.Add(WarningFactory.GetNullInvalidValueWarning(property.Value.ToString())); |
| 1 | 39 | | Descriptor._null = new AtomicPropertyArray<string>(new List<string>() { "" }); |
| | 40 | | } |
| 1 | 41 | | } |
| | 42 | | } |
| | 43 | | } |