| | 1 | | using Newtonsoft.Json.Linq; |
| | 2 | | using ValidateLib.ErrorsAndWarnings.Warnings; |
| | 3 | | using ValidateLib.Metadata.Descriptors; |
| | 4 | | using ValidateLib.UtilityClasses; |
| | 5 | |
|
| | 6 | | namespace ValidateLib.Metadata.PropertyParsers.DataType |
| | 7 | | { |
| | 8 | | internal class BasePropertyParser : PropertyParserBase<DatatypeDescriptor>, IPropertyParser<DatatypeDescriptor> |
| | 9 | | { |
| 1 | 10 | | public BasePropertyParser(List<Warning> warnings, DatatypeDescriptor descriptor) : base(warnings, descriptor) |
| | 11 | | { |
| 1 | 12 | | } |
| | 13 | |
|
| | 14 | | public void ParseProperty(JProperty property) |
| | 15 | | { |
| 1 | 16 | | if (property.Value.Type != JTokenType.String) |
| | 17 | | { |
| 0 | 18 | | Warnings.Add(WarningFactory.GetStringPropertyWrongValueWarning(property.Value, property.Name, property.V |
| 0 | 19 | | Descriptor._base = new Properties.AtomicProperties.AtomicPropertyString("string"); |
| 0 | 20 | | return; |
| | 21 | | } |
| | 22 | | else |
| | 23 | | { |
| 1 | 24 | | if (!DatatypeUtilityClass.IsBuiltInType(property.Value.ToString())) |
| | 25 | | { |
| 1 | 26 | | Warnings.Add(WarningFactory.GetDatatypeBaseWrongValueWarning(property.Value.ToString())); |
| 1 | 27 | | Descriptor._base = new Properties.AtomicProperties.AtomicPropertyString("string"); |
| 1 | 28 | | return; |
| | 29 | | } |
| | 30 | | else |
| | 31 | | { |
| 1 | 32 | | Descriptor._base = new Properties.AtomicProperties.AtomicPropertyString(property.Value.ToString()); |
| | 33 | | } |
| | 34 | | } |
| 1 | 35 | | } |
| | 36 | | } |
| | 37 | | } |