FirelyTeam / firely-net-sdk

The official Firely .NET SDK for HL7 FHIR
Other
816 stars 340 forks source link

Wierd results from ResourceBase and ResourceIdentity #2795

Closed LodewijkSioen closed 3 weeks ago

LodewijkSioen commented 1 month ago

Describe the bug Both the ResourceBase property and the ResourceIdentity extension method produce strange results

To Reproduce The following code:

var client = new FhirClient("http://localhost:8080");
var patient = new Patient();

Console.WriteLine("Unsaved Patient");
Console.WriteLine(patient.ResourceBase);
Console.WriteLine(patient.ResourceIdentity());

Console.WriteLine("Saved Patient");
var newPatient = await client.CreateAsync(patient);
Console.WriteLine(newPatient.ResourceBase);
Console.WriteLine(newPatient.ResourceIdentity());

Console.WriteLine("Read Patient");
var patientGet = await client.ReadAsync<Patient>($"Patient/{newPatient.Id}");
Console.WriteLine(patientGet.ResourceBase);
Console.WriteLine(patientGet.ResourceIdentity());

Produces:

Unsaved Patient

Saved Patient
http://localhost:8080/Patient
http://localhost:8080/Patient/Patient/fc4a7d76-cf89-4513-8ae1-23cb4344e521/_history/1
Read Patient
http://localhost:8080/Patient/fc4a7d76-cf89-4513-8ae1-23cb4344e521
http://localhost:8080/Patient/fc4a7d76-cf89-4513-8ae1-23cb4344e521/Patient/fc4a7d76-cf89-4513-8ae1-23cb4344e521/_history/1

Expected behavior I think ResourceBase should always return http://localhost:8080 in this case. That should fix ResourceIdentity

Version used: