-
Notifications
You must be signed in to change notification settings - Fork 157
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
Unable to disambiguate inherited fields in fhir-model #2384
Comments
its a private member so should be safe for us to change. let me give it a go quick and maybe you can help confirm that its as simple as I think it is... |
There's no need for each concrete type to define / redefine its own private member for this and it was causing some trouble with downstream tooling. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
There's no need for each concrete type to define / redefine its own private member for this and it was causing some trouble with downstream tooling. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
#2385) There's no need for each concrete type to define / redefine its own private member for this and it was causing some trouble with downstream tooling. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
@eboozer these changes were shipped in IBM FHIR Server 4.8.1 ...mind trying with that or 4.8.2 and confirming that it addresses the issue you were seeing? If we don't hear back in a day or two, we'll plan to close the issue. |
That's awesome! Thank you for following up. I was able to figure out a temporary workaround/hack to bypass the issue. But I should be able to revert that change in the next couple of days to confirm. I will follow-up as soon as I know. |
Marking this closed...please reopen if you find it not working as expected. |
Yes, I was able to confirm that this corrected my issue. Thank you for the quick turnaround. |
Describe the bug
I am currently attempting to use the fhir-model using the Spring-boot framework with MongoDB. Unfortunately, there is a convention used in each of the resource classes that is preventing me from creating the MongoDB document. It looks like each resource creates its own private
hashCode
field that is used for thehashCode
method. Unfortunately, when spring-boot attempts to convert these resources into a document type, it is unable to "disambiguate" the fields between the child and parent classes. This appears to be an issue with all of theResource
objects, so the included below call stack only includes the "first" conflict Spring-boot runs across.The call stack is rather tall, but here is the relevant portion:
Since this is a 3rd party jar, the proposed resolution in the stack is impossible to do (without some amount of hackery and bad practices), and wouldn't make sense to implement it for everyone that consumes the jar. However, I believe a better completely passive fix for this would be to simply change the
hashCode
toprotected
instead ofprivate
for the root elements, and remove the field for all of the child classes. This would allow access for each resource type without the conflict, and should be 100% passive with the functionality. It would be a bit tedious to change each of the resources, but I'm willing to make the change if we agree this is an issue.Environment
To Reproduce
Steps to reproduce the behavior:
hashCode
field and extends other object that also has ahashCode
fieldExpected behavior
A fhir-model Resource type should be able to be saved to a Spring-boot MongoDB without issue
The text was updated successfully, but these errors were encountered: