-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support collection.abc.Mapping
as resource instead of only dict
#44
Conversation
Relaxed assumptions: resource should be Mapping instead of dict
@ruscoder What do you think of this approach? |
This reverts commit a172746.
Hi @axelv, it looks good to me, thanks. |
@ruscoder what do you think of this? Is it OK if I start a PR for this? |
@axelv it will be great to have it here |
This is harder than I thought because |
@axelv consider using MutableSequence
|
@axelv btw, do you have a real-world use case for using list-like structures together with fhirpath py? |
Yes, I want create custom lists to make slices accessible by name in Python: https://github.com/axelv/pydantic-fhir-slicing |
This slight modification to the engine relaxes the assumption that a resource node must be a Python
dictionary
by changingsome
isinstance
checks:This allows us to pass Pydantic objects or dataclasses and preserve metadata and methods defined on those objects and solves the issue described here #43.
Let me know what you think and if adaptation are needed 🙌
FYI: I think a similar relaxation of
list
toSequence
would also be possible 🙂