| | | 1 | | using Newtonsoft.Json.Linq; |
| | | 2 | | using ValidateLib.ErrorsAndWarnings.Warnings; |
| | | 3 | | using ValidateLib.Metadata.Descriptors; |
| | | 4 | | using ValidateLib.Metadata.Parsers; |
| | | 5 | | using ValidateLib.Metadata.Properties; |
| | | 6 | | using ValidateLib.Metadata.Validators; |
| | | 7 | | |
| | | 8 | | namespace ValidateLib.Metadata.PropertyParsers.TopLevelObject |
| | | 9 | | { |
| | | 10 | | public class TableSchemaPropertyParser : PropertyParserBase<TopLevelObjectDescriptor>, IPropertyParser<TopLevelObjec |
| | | 11 | | { |
| | 1 | 12 | | public TableSchemaPropertyParser(List<Warning> warnings, TopLevelObjectDescriptor descriptor) : base(warnings, d |
| | | 13 | | { |
| | 1 | 14 | | } |
| | | 15 | | |
| | | 16 | | public void ParseProperty(JProperty property) |
| | | 17 | | { |
| | 1 | 18 | | var tableSchemaParser = new SchemaParser(Warnings); |
| | 1 | 19 | | var tableSchemaDescriptor = tableSchemaParser.ParseJToken(property.Value, property.Name); |
| | 1 | 20 | | var primaryKeyValidator = new PrimaryKeyValidator(); |
| | 1 | 21 | | Warnings.AddRange(primaryKeyValidator.Validate(tableSchemaDescriptor)); |
| | 1 | 22 | | if (!tableSchemaDescriptor.IsInvalid) |
| | 1 | 23 | | Descriptor.tableSchema = new ObjectProperty<SchemaDescriptor>(tableSchemaDescriptor); |
| | | 24 | | else |
| | | 25 | | { |
| | 1 | 26 | | Descriptor.tableSchema = new ObjectProperty<SchemaDescriptor>(new SchemaDescriptor()); |
| | | 27 | | } |
| | | 28 | | |
| | 1 | 29 | | } |
| | | 30 | | } |
| | | 31 | | } |