| | 1 | | using System.Diagnostics.CodeAnalysis; |
| | 2 | | using System.Text.Json.Serialization; |
| | 3 | | using Spdx3.Serialization; |
| | 4 | | using Spdx3.Utility; |
| | 5 | |
|
| | 6 | | namespace Spdx3.Model.Extension.Classes; |
| | 7 | |
|
| | 8 | | /// <summary> |
| | 9 | | /// A property name with an associated value. |
| | 10 | | /// See https://spdx.github.io/spdx-spec/v3.0.1/model/Extension/Classes/CdxPropertyEntry/ |
| | 11 | | /// </summary> |
| | 12 | | public class CdxPropertyEntry : BaseModelClass |
| | 13 | | { |
| | 14 | | [JsonPropertyName("extension_cdxPropName")] |
| | 15 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 11 | 16 | | public required string CdxPropName { get; set; } |
| | 17 | |
|
| | 18 | | [JsonPropertyName("extension_cdxPropValue")] |
| | 19 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 5 | 20 | | public string? CdxPropValue { get; set; } |
| | 21 | |
|
| | 22 | | // protected internal no-parm constructor required for deserialization |
| | 23 | | // ReSharper disable once UnusedMember.Global |
| 3 | 24 | | protected internal CdxPropertyEntry() |
| | 25 | | { |
| 3 | 26 | | } |
| | 27 | |
|
| | 28 | | [SetsRequiredMembers] |
| 2 | 29 | | public CdxPropertyEntry(Catalog catalog, string cdxPropName, string cdxPropValue) : this(catalog, cdxPropName) |
| | 30 | | { |
| 2 | 31 | | CdxPropValue = cdxPropValue; |
| 2 | 32 | | } |
| | 33 | |
|
| | 34 | | [method: SetsRequiredMembers] |
| 5 | 35 | | public CdxPropertyEntry(Catalog catalog, string cdxPropName) : base(catalog) |
| | 36 | | { |
| 5 | 37 | | CdxPropName = cdxPropName; |
| 5 | 38 | | } |
| | 39 | |
|
| | 40 | | public override void Validate() |
| | 41 | | { |
| 3 | 42 | | base.Validate(); |
| 2 | 43 | | ValidateRequiredProperty(nameof(CdxPropName)); |
| 2 | 44 | | } |
| | 45 | | } |