Skip to content

Commit

Permalink
Use string also as a valid type for the input value of memberOf()
Browse files Browse the repository at this point in the history
  • Loading branch information
marcovisserFurore committed Sep 15, 2023
1 parent 67aa967 commit 2fc5288
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Hl7.Fhir.Base/FhirPath/ElementNavFhirExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ internal static P.Time BoundaryTime(P.Time time, long? precision, int minutes, i
"code" when input is ScopedNode sn => inParams.WithCode(code: sn.Value as string, context: sn.LocalLocation),
"Coding" => inParams.WithCoding(input.ParseCoding()),
"CodeableConcept" => inParams.WithCodeableConcept(input.ParseCodeableConcept()),
"System.String" => inParams.WithCode(code: input.Value as string, context: "No context available"),
"string" or "System.String" => inParams.WithCode(code: input.Value as string, context: "No context available"),
_ => null,
};

Expand Down
6 changes: 6 additions & 0 deletions src/Hl7.FhirPath.R4.Tests/PocoTests/FhirPathTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,12 @@ public static IEnumerable<object[]> MemberOfTestData()
}, "memberOf('http://hl7.org/fhir/ValueSet/observation-vitalsignresult')", true };

// memberOf with string objects
yield return new object[] { new FhirString("85353-1"), "memberOf('http://hl7.org/fhir/ValueSet/observation-vitalsignresult')", true };
yield return new object[] { new FhirString("male"), "memberOf('http://hl7.org/fhir/ValueSet/administrative-gender')", true };
yield return new object[] { new FhirString("female"), "memberOf('http://hl7.org/fhir/ValueSet/administrative-gender')", true };
yield return new object[] { new FhirString("no-idea"), "memberOf('http://hl7.org/fhir/ValueSet/administrative-gender')", false };

// memberOf with inline string objects
yield return new object[] { new FhirBoolean(), "'85353-1'.memberOf('http://hl7.org/fhir/ValueSet/observation-vitalsignresult')", true };
yield return new object[] { new FhirBoolean(), "'male'.memberOf('http://hl7.org/fhir/ValueSet/administrative-gender')", true };
yield return new object[] { new FhirBoolean(), "'female'.memberOf('http://hl7.org/fhir/ValueSet/administrative-gender')", true };
Expand Down

0 comments on commit 2fc5288

Please sign in to comment.