/// <summary> /// Deserialize JSON into a FHIR BackboneElement /// </summary> public static void DeserializeJsonProperty(this BackboneElement current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "modifierExtension": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"BackboneElement error reading 'modifierExtension' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.ModifierExtension = new List <Extension>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Extension v_ModifierExtension = new Hl7.Fhir.Model.Extension(); v_ModifierExtension.DeserializeJson(ref reader, options); current.ModifierExtension.Add(v_ModifierExtension); if (!reader.Read()) { throw new JsonException($"BackboneElement error reading 'modifierExtension' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.ModifierExtension.Count == 0) { current.ModifierExtension = null; } break; // Complex: BackboneElement, Export: BackboneElement, Base: Element default: ((Hl7.Fhir.Model.Element)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR Element /// </summary> public static void DeserializeJsonProperty(this Element current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "id": current.ElementId = reader.GetString(); break; case "extension": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Element error reading 'extension' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Extension = new List <Extension>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Extension v_Extension = new Hl7.Fhir.Model.Extension(); v_Extension.DeserializeJson(ref reader, options); current.Extension.Add(v_Extension); if (!reader.Read()) { throw new JsonException($"Element error reading 'extension' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Extension.Count == 0) { current.Extension = null; } break; } }
/// <summary> /// Deserialize JSON into a FHIR DomainResource /// </summary> public static void DeserializeJsonProperty(this DomainResource current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "text": current.Text = new Hl7.Fhir.Model.Narrative(); ((Hl7.Fhir.Model.Narrative)current.Text).DeserializeJson(ref reader, options); break; case "contained": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DomainResource error reading 'contained' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Contained = new List <Resource>(); while (reader.TokenType != JsonTokenType.EndArray) { current.Contained.Add(JsonStreamResourceConverter.PolymorphicRead(ref reader, typeof(Resource), options)); if (!reader.Read()) { throw new JsonException($"DomainResource error reading 'contained' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Contained.Count == 0) { current.Contained = null; } break; case "extension": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DomainResource error reading 'extension' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Extension = new List <Extension>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Extension v_Extension = new Hl7.Fhir.Model.Extension(); v_Extension.DeserializeJson(ref reader, options); current.Extension.Add(v_Extension); if (!reader.Read()) { throw new JsonException($"DomainResource error reading 'extension' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Extension.Count == 0) { current.Extension = null; } break; case "modifierExtension": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DomainResource error reading 'modifierExtension' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.ModifierExtension = new List <Extension>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Extension v_ModifierExtension = new Hl7.Fhir.Model.Extension(); v_ModifierExtension.DeserializeJson(ref reader, options); current.ModifierExtension.Add(v_ModifierExtension); if (!reader.Read()) { throw new JsonException($"DomainResource error reading 'modifierExtension' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.ModifierExtension.Count == 0) { current.ModifierExtension = null; } break; // Complex: DomainResource, Export: DomainResource, Base: Resource default: ((Hl7.Fhir.Model.Resource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }