diff --git a/src/Hl7.Fhir.Base/Model/Base64Binary.cs b/src/Hl7.Fhir.Base/Model/Base64Binary.cs
index d0ea46b7a..9e2492e2c 100644
--- a/src/Hl7.Fhir.Base/Model/Base64Binary.cs
+++ b/src/Hl7.Fhir.Base/Model/Base64Binary.cs
@@ -87,6 +87,10 @@ public override object? ObjectValue
[NonSerialized] // To prevent binary serialization from serializing this field
private byte[]? _parsedValue = null;
+ ///
+ /// Validates the JsonValue and updates the internal cached byte[] Value, releasing
+ /// the data in JsonValue to save memory.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context)
{
if (_parsedValue is not null || base.ObjectValue is null) return null;
diff --git a/src/Hl7.Fhir.Base/Model/Canonical.cs b/src/Hl7.Fhir.Base/Model/Canonical.cs
index b533d2b51..eb0e8a916 100644
--- a/src/Hl7.Fhir.Base/Model/Canonical.cs
+++ b/src/Hl7.Fhir.Base/Model/Canonical.cs
@@ -95,6 +95,9 @@ public void Deconstruct(out string? uri, out string? version, out string? fragme
///
public static implicit operator string?(Canonical? value) => value?.Value;
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/Code.cs b/src/Hl7.Fhir.Base/Model/Code.cs
index 43f6b5526..7978083ba 100644
--- a/src/Hl7.Fhir.Base/Model/Code.cs
+++ b/src/Hl7.Fhir.Base/Model/Code.cs
@@ -55,6 +55,9 @@ Value is not null
? new P.Code(system: null, code: Value, display: null, version: null)
: null;
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/CodeOfT.cs b/src/Hl7.Fhir.Base/Model/CodeOfT.cs
index 6bc04c28a..119404eaf 100644
--- a/src/Hl7.Fhir.Base/Model/CodeOfT.cs
+++ b/src/Hl7.Fhir.Base/Model/CodeOfT.cs
@@ -108,6 +108,9 @@ public override object? ObjectValue
}
}
+ ///
+ /// Validates the JsonValue and updates the internal cached enum Value.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context)
{
if (_parsedValue is not null || base.ObjectValue is null) return null;
diff --git a/src/Hl7.Fhir.Base/Model/Date.cs b/src/Hl7.Fhir.Base/Model/Date.cs
index 8496641d3..177c8a289 100644
--- a/src/Hl7.Fhir.Base/Model/Date.cs
+++ b/src/Hl7.Fhir.Base/Model/Date.cs
@@ -71,6 +71,9 @@ public Date(int year) : this(string.Format(System.Globalization.CultureInfo.Inva
[NonSerialized] // To prevent binary serialization from serializing this field
private P.Date? _parsedValue = null;
+ ///
+ /// Validates the JsonValue and updates the internal cached Date value.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context)
{
if (_parsedValue is not null || base.ObjectValue is null) return null;
diff --git a/src/Hl7.Fhir.Base/Model/FhirBoolean.cs b/src/Hl7.Fhir.Base/Model/FhirBoolean.cs
index 55b53cf27..ebfc2bbd3 100644
--- a/src/Hl7.Fhir.Base/Model/FhirBoolean.cs
+++ b/src/Hl7.Fhir.Base/Model/FhirBoolean.cs
@@ -39,6 +39,9 @@ namespace Hl7.Fhir.Model;
public partial class FhirBoolean
{
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/FhirDateTime.cs b/src/Hl7.Fhir.Base/Model/FhirDateTime.cs
index 0d78460eb..c44493490 100644
--- a/src/Hl7.Fhir.Base/Model/FhirDateTime.cs
+++ b/src/Hl7.Fhir.Base/Model/FhirDateTime.cs
@@ -90,6 +90,9 @@ public FhirDateTime(int year)
[NonSerialized] // To prevent binary serialization from serializing this field
private P.DateTime? _parsedValue = null;
+ ///
+ /// Validates the JsonValue and updates the internal cached DateTime value.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context)
{
if (_parsedValue is not null || base.ObjectValue is null) return null;
diff --git a/src/Hl7.Fhir.Base/Model/FhirDecimal.cs b/src/Hl7.Fhir.Base/Model/FhirDecimal.cs
index 9f0391a7e..87cca2278 100644
--- a/src/Hl7.Fhir.Base/Model/FhirDecimal.cs
+++ b/src/Hl7.Fhir.Base/Model/FhirDecimal.cs
@@ -39,6 +39,9 @@ namespace Hl7.Fhir.Model;
public partial class FhirDecimal
{
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/FhirString.cs b/src/Hl7.Fhir.Base/Model/FhirString.cs
index 081c54c70..ab83545f4 100644
--- a/src/Hl7.Fhir.Base/Model/FhirString.cs
+++ b/src/Hl7.Fhir.Base/Model/FhirString.cs
@@ -39,6 +39,9 @@ namespace Hl7.Fhir.Model;
public partial class FhirString : ICoded
{
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/FhirUri.cs b/src/Hl7.Fhir.Base/Model/FhirUri.cs
index 08023c6f7..6cd67cd68 100644
--- a/src/Hl7.Fhir.Base/Model/FhirUri.cs
+++ b/src/Hl7.Fhir.Base/Model/FhirUri.cs
@@ -45,6 +45,9 @@ public FhirUri(Uri uri)
Value = uri.OriginalString;
}
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/FhirUrl.cs b/src/Hl7.Fhir.Base/Model/FhirUrl.cs
index 13d88acc8..28a63a295 100644
--- a/src/Hl7.Fhir.Base/Model/FhirUrl.cs
+++ b/src/Hl7.Fhir.Base/Model/FhirUrl.cs
@@ -43,6 +43,9 @@ public FhirUrl(Uri uri)
Value = uri.OriginalString;
}
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/Id.cs b/src/Hl7.Fhir.Base/Model/Id.cs
index 8ca7920fe..d355e491e 100644
--- a/src/Hl7.Fhir.Base/Model/Id.cs
+++ b/src/Hl7.Fhir.Base/Model/Id.cs
@@ -41,6 +41,9 @@ namespace Hl7.Fhir.Model;
public partial class Id
{
+ ///
+ /// Validates the JsonValue and updates the internal cached Date value.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/Instant.cs b/src/Hl7.Fhir.Base/Model/Instant.cs
index f36aea746..e8d5352a7 100644
--- a/src/Hl7.Fhir.Base/Model/Instant.cs
+++ b/src/Hl7.Fhir.Base/Model/Instant.cs
@@ -82,6 +82,9 @@ public static Instant FromDateTimeUtc(int year, int month, int day,
[NonSerialized] // To prevent binary serialization from serializing this field
private P.DateTime? _parsedValue = null;
+ ///
+ /// Validates the JsonValue and updates the internal cached CQL DateTime value.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context)
{
if (_parsedValue is not null || base.ObjectValue is null) return null;
diff --git a/src/Hl7.Fhir.Base/Model/Integer.cs b/src/Hl7.Fhir.Base/Model/Integer.cs
index 7f6eaed25..4e1536426 100644
--- a/src/Hl7.Fhir.Base/Model/Integer.cs
+++ b/src/Hl7.Fhir.Base/Model/Integer.cs
@@ -39,6 +39,9 @@ namespace Hl7.Fhir.Model;
public partial class Integer
{
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/Integer64.cs b/src/Hl7.Fhir.Base/Model/Integer64.cs
index 82251c507..e684b93b8 100644
--- a/src/Hl7.Fhir.Base/Model/Integer64.cs
+++ b/src/Hl7.Fhir.Base/Model/Integer64.cs
@@ -68,6 +68,9 @@ public long? Value
[NonSerialized] // To prevent binary serialization from serializing this field
private long? _parsedValue = null;
+ ///
+ /// Validates the JsonValue and updates the internal cached long value.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context)
{
if (_parsedValue is not null || base.ObjectValue is null) return null;
diff --git a/src/Hl7.Fhir.Base/Model/Markdown.cs b/src/Hl7.Fhir.Base/Model/Markdown.cs
index f39279ee7..8a6e472da 100644
--- a/src/Hl7.Fhir.Base/Model/Markdown.cs
+++ b/src/Hl7.Fhir.Base/Model/Markdown.cs
@@ -39,6 +39,9 @@ namespace Hl7.Fhir.Model;
public partial class Markdown
{
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/Oid.cs b/src/Hl7.Fhir.Base/Model/Oid.cs
index dca42a8d9..36b37c193 100644
--- a/src/Hl7.Fhir.Base/Model/Oid.cs
+++ b/src/Hl7.Fhir.Base/Model/Oid.cs
@@ -39,6 +39,7 @@ namespace Hl7.Fhir.Model;
public partial class Oid
{
+ /// Validates the JsonValue.
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/PositiveInt.cs b/src/Hl7.Fhir.Base/Model/PositiveInt.cs
index 38a243d50..c497925ff 100644
--- a/src/Hl7.Fhir.Base/Model/PositiveInt.cs
+++ b/src/Hl7.Fhir.Base/Model/PositiveInt.cs
@@ -39,6 +39,7 @@ namespace Hl7.Fhir.Model;
public partial class PositiveInt
{
+ /// Validates the JsonValue.
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/PrimitiveType.cs b/src/Hl7.Fhir.Base/Model/PrimitiveType.cs
index ff3a823e2..90bd931c6 100644
--- a/src/Hl7.Fhir.Base/Model/PrimitiveType.cs
+++ b/src/Hl7.Fhir.Base/Model/PrimitiveType.cs
@@ -62,6 +62,10 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali
protected virtual IEnumerable Validate(ValidationContext validationContext) =>
ValidateObjectValue(validationContext) is { } result ? [result.AsResult(validationContext)] : [];
+ ///
+ /// Validates the JsonValue. Some subclasses will also, as a side-effect, update
+ /// their internal cache if parsing and validating is expensive.
+ ///
protected internal abstract CodedValidationException? ValidateObjectValue(ValidationContext? validationContext);
public bool HasValidValue() => ValidateObjectValue(null) is null;
diff --git a/src/Hl7.Fhir.Base/Model/Time.cs b/src/Hl7.Fhir.Base/Model/Time.cs
index 57c79dcb6..091bbdfe7 100644
--- a/src/Hl7.Fhir.Base/Model/Time.cs
+++ b/src/Hl7.Fhir.Base/Model/Time.cs
@@ -61,6 +61,9 @@ public Time(int hour, int minute, int second) : this(string.Format(CultureInfo.I
[NonSerialized] // To prevent binary serialization from serializing this field
private P.Time? _parsedValue = null;
+ ///
+ /// Validates the JsonValue and updates the internal cached Time value.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context)
{
if (_parsedValue is not null || base.ObjectValue is null) return null;
diff --git a/src/Hl7.Fhir.Base/Model/UnsignedInt.cs b/src/Hl7.Fhir.Base/Model/UnsignedInt.cs
index 91795b868..4c466db01 100644
--- a/src/Hl7.Fhir.Base/Model/UnsignedInt.cs
+++ b/src/Hl7.Fhir.Base/Model/UnsignedInt.cs
@@ -39,6 +39,9 @@ namespace Hl7.Fhir.Model;
public partial class UnsignedInt
{
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/Uuid.cs b/src/Hl7.Fhir.Base/Model/Uuid.cs
index 1ee7143dc..c00baefa0 100644
--- a/src/Hl7.Fhir.Base/Model/Uuid.cs
+++ b/src/Hl7.Fhir.Base/Model/Uuid.cs
@@ -55,6 +55,9 @@ public static Uuid Generate()
///
public FhirUri AsUri() => new(Value);
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{
diff --git a/src/Hl7.Fhir.Base/Model/XHtml.cs b/src/Hl7.Fhir.Base/Model/XHtml.cs
index 5a72559fd..997680c4f 100644
--- a/src/Hl7.Fhir.Base/Model/XHtml.cs
+++ b/src/Hl7.Fhir.Base/Model/XHtml.cs
@@ -45,6 +45,9 @@ namespace Hl7.Fhir.Model;
///
public partial class XHtml
{
+ ///
+ /// Validates the JsonValue.
+ ///
protected internal override COVE? ValidateObjectValue(ValidationContext? context) =>
ObjectValue switch
{