You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When validating a resource using the Hl7.Fhir.Validation.Legacy Validator, if the slicing discrimator path uses the resolve() function an error of Internal logic failure: Unknown symbol 'resolve' will be returned in the OperationOutcome.
To Reproduce
Steps to reproduce the behavior:
Using the IG Publisher, create a new Appointment.fsh file with the following profile to generate a package.tgz file (see the attached StructureDefinition-TestAppointment.json for SD output):
const string pathToPackageTgz = "/pathto/package.tgz";
FhirPackageSource sourceResolver = new FhirPackageSource(ModelInfo.ModelInspector, new[] { pathToPackageTgz });
MultiResolver resolver = new MultiResolver(sourceResolver, ZipSource.CreateValidationSource());
SymbolTable symbolTable = new SymbolTable();
symbolTable.AddStandardFP();
symbolTable.AddFhirExtensions();
FhirPathCompiler compiler = new FhirPathCompiler(symbolTable);
ValidationSettings settings = new ValidationSettings()
{
FhirPathCompiler = compiler,
ResourceResolver = resolver
};
Validator validator = new Validator(settings);
Appointment appointment = new Appointment()
{
Contained = new List<Resource>()
{
new Patient()
{
Id = "pat1",
Name = new List<HumanName>() { new HumanName() { Family = "given" } }
}
},
Status = Appointment.AppointmentStatus.Proposed,
Participant = new List<Appointment.ParticipantComponent>()
{
new Appointment.ParticipantComponent()
{
Actor = new ResourceReference()
{
Reference = "#pat1",
Type = "Patient"
},
Status = ParticipationStatus.Accepted
}
}
};
OperationOutcome oo = validator.Validate(appointment.ToTypedElement(), new[] { "http://fhir.myawesomesite.net/StructureDefinition/TestAppointment" });
Expected behavior
Validation should succeed as the slice discriminator should resolve to the contained Patient resource.
Version used:
FHIR Version: R4 and R5
Version: Hl7.Fhir.Validation.Legacy 5.1 and firely-net-sdk 5.1
Additional context
It appears even with a provided FhirPathCompiler with the SymbolTable.AddFhirExtensions() extension function called, the provided compiler isn't used and a default FhirPathCompiler is used with only the standard SymbolTable. The provided FhirPathCompiler has 155 entries in the SymbolTable and when the exception about the missing symbol is thrown there are only 150 entries in the SymbolTable being used. Looking through the stack, it appears that the FhirPathCompilerCache only uses a FhirPathCompiler with the default SymbolTable.
When evaluating the discriminator, the stack follows:
As a test I modified the FhirPathCompilerCache to use new FhirPathCompiler(FhirPathCompiler.DefaultSymbolTable.AddFhirExtensions()) which resulted in the resolve() function being used and the validation succeeded. (Note, I'm not suggesting changing the SymbolTable in the cache, just showing how I was able to get successful validation)
The text was updated successfully, but these errors were encountered:
Describe the bug
When validating a resource using the Hl7.Fhir.Validation.Legacy Validator, if the slicing discrimator path uses the
resolve()
function an error ofInternal logic failure: Unknown symbol 'resolve'
will be returned in the OperationOutcome.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Validation should succeed as the slice discriminator should resolve to the contained Patient resource.
Version used:
Additional context
It appears even with a provided
FhirPathCompiler
with theSymbolTable.AddFhirExtensions()
extension function called, the provided compiler isn't used and a defaultFhirPathCompiler
is used with only the standardSymbolTable
. The providedFhirPathCompiler
has 155 entries in the SymbolTable and when the exception about the missing symbol is thrown there are only 150 entries in the SymbolTable being used. Looking through the stack, it appears that theFhirPathCompilerCache
only uses aFhirPathCompiler
with the defaultSymbolTable
.When evaluating the discriminator, the stack follows:
Examining how the cache is loaded, it uses compiler: null which will then in the FhirPathCompilerCache constructor use the DefaultSymbolTable.
As a test I modified the
FhirPathCompilerCache
to usenew FhirPathCompiler(FhirPathCompiler.DefaultSymbolTable.AddFhirExtensions())
which resulted in theresolve()
function being used and the validation succeeded. (Note, I'm not suggesting changing the SymbolTable in the cache, just showing how I was able to get successful validation)The text was updated successfully, but these errors were encountered: