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
Our integrator sends us extra fields in their response JSON that aren't part of resource definition. For example, their DocumentReference resource json has extra fields created, indexed and class. Running DocumentReference.parse_obj(response_json) throws error such as extra fields not permitted (type=value_error.extra).
Our current workaround is to override the abstract model before calling parse_obj: FHIRAbstractModel.Config.extra = Extra.allow. This feels too hacky.
Maybe fhir.resources could surface an argument like allow_extra for parse_obj?
What I Did
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
The text was updated successfully, but these errors were encountered:
Hi @Mo-Di first of all, thanks a lot for using this library.
I like your idea that would give developers more flexibilities to handle nonstandard fields. Unfortunately, we cannot allow
any nonstandard field like this, as you know this library is 100% complying with FHIR Specification, besides Config.extra is in class level should not modify from function/method.
I think your current approach is good for now.
There are many ways to put extra (nonstandard info) inside FHIR resource for example Extension, Meta you could ask your integrator to implement, or maybe you do some filter on the extra field (perhaps generate an Extension ) before constructing FHIR Object
Description
Our integrator sends us extra fields in their response JSON that aren't part of resource definition. For example, their
DocumentReference
resource json has extra fieldscreated
,indexed
andclass
. RunningDocumentReference.parse_obj(response_json)
throws error such asextra fields not permitted (type=value_error.extra)
.Our current workaround is to override the abstract model before calling
parse_obj
:FHIRAbstractModel.Config.extra = Extra.allow
. This feels too hacky.Maybe
fhir.resources
could surface an argument likeallow_extra
forparse_obj
?What I Did
The text was updated successfully, but these errors were encountered: