Closed johnjameswhitman closed 2 years ago
Sorry to hear about your problem. I think that breaking changes for not one particular reason. If you look at our overridden FHIRAbstractModel.dict is internally using two custom methods (_fhir_iter() & _fhir_get_value()) (have to) & way of calculating allowed fields are different than pydantic.
//We rely on exclude_unset, which determines whether fields which were not explicitly set when creating the model should// Can you please describe with an example of your use case? about explicitly set.
We will try to add that feature, but it could be really good if we found this issue before the stable release [during beta release].
The new release v6.2.1 should prevent the breaking situation.
Thank you @nazrulworld!
Description
We're currently on v6.1 and are testing an upgrade to v6.2 but our tests for a method that works with both
fhir.resources
and regularpydantic
models fails with this message:We rely on
exclude_unset
, which determines whether fields which were not explicitly set when creating the model should be excluded from the returned dictionary (pydantic
docs).Then I noticed this from the 6.2.0b1 release notes:
I see this is the commit that tweaks the signature of
fhir.resources.fhirabstractmodel.FHIRAbstractModel.dict()
.What I Did
It seems like the underlying
BaseModel
keeps track of a__fields_set__
property (pydantic docs) we might be able to use to shoehornexclude_unset
back into the newdict()
implementation; however, I'm curious if it was removed for a specific reason?