| | 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 | |
|
| | 7 | | namespace ValidateLib.Metadata.PropertyParsers.ForeignKey |
| | 8 | | { |
| | 9 | | internal class ReferencePropertyParser : PropertyParserBase<ForeignKeyDescriptor>, IPropertyParser<ForeignKeyDescrip |
| | 10 | | { |
| 1 | 11 | | public ReferencePropertyParser(List<Warning> warnings, ForeignKeyDescriptor descriptor) : base(warnings, descrip |
| | 12 | | { |
| 1 | 13 | | } |
| | 14 | |
|
| | 15 | | public void ParseProperty(JProperty property) |
| | 16 | | { |
| 1 | 17 | | var referenceParser = new ReferenceParser(Warnings); |
| 1 | 18 | | var referencePropertyDescriptor = referenceParser.ParseJToken(property.Value, property.Name); |
| 1 | 19 | | if (!referencePropertyDescriptor.IsInvalid) Descriptor.reference = new ObjectProperty<ReferenceDescriptor>(r |
| | 20 | | else |
| | 21 | | { |
| 1 | 22 | | Descriptor.reference = new ObjectProperty<ReferenceDescriptor>(new ReferenceDescriptor()); |
| 1 | 23 | | Descriptor.reference._value.CheckRequiredPropertiesPresent(); |
| | 24 | | } |
| | 25 | |
|
| 0 | 26 | | } |
| | 27 | | } |
| | 28 | | } |