/// <summary> /// Deserialize JSON into a FHIR CatalogEntry#RelatedEntry /// </summary> public static void DeserializeJson(this CatalogEntry.RelatedEntryComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options) { string propertyName; while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject) { return; } if (reader.TokenType == JsonTokenType.PropertyName) { propertyName = reader.GetString(); if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug) { Console.WriteLine($"CatalogEntry.RelatedEntryComponent >>> CatalogEntry#RelatedEntry.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } reader.Read(); current.DeserializeJsonProperty(ref reader, options, propertyName); } } throw new JsonException($"CatalogEntry.RelatedEntryComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); }
/// <summary> /// Deserialize JSON into a FHIR CatalogEntry#RelatedEntry /// </summary> public static void DeserializeJsonProperty(this CatalogEntry.RelatedEntryComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "relationtype": if (reader.TokenType == JsonTokenType.Null) { current.RelationtypeElement = new Code <Hl7.Fhir.Model.CatalogEntry.CatalogEntryRelationType>(); reader.Skip(); } else { current.RelationtypeElement = new Code <Hl7.Fhir.Model.CatalogEntry.CatalogEntryRelationType>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.CatalogEntry.CatalogEntryRelationType>(reader.GetString())); } break; case "_relationtype": if (current.RelationtypeElement == null) { current.RelationtypeElement = new Code <Hl7.Fhir.Model.CatalogEntry.CatalogEntryRelationType>(); } ((Hl7.Fhir.Model.Element)current.RelationtypeElement).DeserializeJson(ref reader, options); break; case "item": current.Item = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Item).DeserializeJson(ref reader, options); break; // Complex: relatedEntry, Export: RelatedEntryComponent, Base: BackboneElement default: ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Serialize a FHIR CatalogEntry#RelatedEntry into JSON /// </summary> public static void SerializeJson(this CatalogEntry.RelatedEntryComponent current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } // Component: CatalogEntry#RelatedEntry, Export: RelatedEntryComponent, Base: BackboneElement (BackboneElement) ((Hl7.Fhir.Model.BackboneElement)current).SerializeJson(writer, options, false); writer.WriteString("relationtype", Hl7.Fhir.Utility.EnumUtility.GetLiteral(current.RelationtypeElement.Value)); writer.WritePropertyName("item"); current.Item.SerializeJson(writer, options); if (includeStartObject) { writer.WriteEndObject(); } }