Skip to content

Commit

Permalink
Merge pull request #2591 from FirelyTeam/feature/2588-memberOf-with-s…
Browse files Browse the repository at this point in the history
…tring-input

Use `string` also as a valid type for the input value of `memberOf()`
  • Loading branch information
ewoutkramer authored Sep 21, 2023
2 parents 1068e70 + d6771ce commit cc98cfb
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 cc98cfb

Please sign in to comment.