-
Notifications
You must be signed in to change notification settings - Fork 11
Fix equality check for non-data classes #37
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
Conversation
Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ellykits!
As discussed earlier today, can you please see if you can write equality tests for all the example resources we have? so load all the example resources, for each resource load twice and check that they are equal.
I'm not sure how to check inequality... seems like we should, but I don't have a good idea how to do that systematically.
fhir-model/src/commonMain/kotlin/com/google/fhir/model/r5/SecurityLabels.kt
Show resolved
Hide resolved
fhir-codegen/gradle-plugin/src/main/kotlin/com/google/fhir/codegen/ModelTypeSpecGenerator.kt
Show resolved
Hide resolved
fhir-codegen/gradle-plugin/src/main/kotlin/com/google/fhir/codegen/ModelTypeSpecGenerator.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
Fixed equality checks for the FhirDate and FhirDateTime classes we generate by making them data classes. Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
@jingtang10 I have implemented the round-trip test for the resource comparison for R4 via this commit message - 0ca74e1c8a (investigating NullPointer exception for R4B and R5), as a placeholder inside the current file |
Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
NullPointerException resolved. I've added the test cases for R4B and R5. |
I think should be in a separate file - and extract the common utilities. |
Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
Done! |
fhir-model/src/commonTest/kotlin/com/google/fhir/model/EqualityCheckTest.kt
Show resolved
Hide resolved
fhir-model/src/commonTest/kotlin/com/google/fhir/model/EqualityCheckTest.kt
Outdated
Show resolved
Hide resolved
fhir-model/src/commonTest/kotlin/com/google/fhir/model/TestLoader.kt
Outdated
Show resolved
Hide resolved
fhir-model/src/commonTest/kotlin/com/google/fhir/model/TestLoader.kt
Outdated
Show resolved
Hide resolved
fhir-model/src/commonTest/kotlin/com/google/fhir/model/EqualityCheckTest.kt
Outdated
Show resolved
Hide resolved
fhir-model/src/commonTest/kotlin/com/google/fhir/model/TestLoader.kt
Outdated
Show resolved
Hide resolved
fhir-model/src/commonTest/kotlin/com/google/fhir/model/EqualityCheckTest.kt
Show resolved
Hide resolved
fhir-model/src/commonTest/kotlin/com/google/fhir/model/TestLoader.kt
Outdated
Show resolved
Hide resolved
Renamed EqualityCheckTest to EqualityTest. Separate exclusion list for the test cases Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
Thanks Elly for addressing the comments - the only thing remaining is the |
Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
From my investigations:
Here as the structure definitions that use common binding name "SecurityLabels" with different value sets.
|
Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
Thanks for the very detailed explanation @ellykits! Is it possible to change the codegen so that in such cases we throw an exception? Just so that we're not relying on finding such problems by chance. |
A couple of additional points: according to this https://chat.fhir.org/#narrow/channel/179166-implementers/topic/Kotlin.20FHIR.20model.20code.20generation.20questions, i wonder if we should use the name of the valueset instead of the binding name extension. @ellykits mentioned there was some issues with that approach for us - please doublecheck and let's document them. So the approach taken here is that we pick the valueset that is the superset of the other conflicting valuesets, and ignore those valuests... the problem here is that we're actually increasing the number of possible values for fields referring to the smaller valuesets. Another problem is that this is just not a very scalable and robust approach since it requires us inspecting the conflicts. This still might be ok if these are the only cases we're dealing with. (We might find out these aren't after we add the exception in my previous comment). An alternative approach is to generate local enums for conflicts. So if two bindings are conflicting. We simply avoid generating global enums. I'm not saying we should definitely do it, let's do the investigation above - and have this approach in our back pocket. |
Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving - but pls merge only after #44 is merged this is updated (and verify that the changes in SecurityLabels.kt
are reverted).
Co-authored-by: Jing Tang <jingtang@google.com>
Signed-off-by: Elly Kitoto <junkmailstoelly@gmail.com>
…r into fix-equality-strings
dependencies { | ||
implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought i commented on this :/ let's remove this in a subsequent PR (probably no need to send a 1 line change)
Sure. I forgot about this, thanks for this reminder.
…On Thu, Aug 21, 2025, 19:45 Jing Tang ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In fhir-model/build.gradle.kts
<#37 (comment)>:
> + dependencies {
+ implementation("org.jetbrains.kotlin:kotlin-reflect")
+ }
I thought i commented on this :/ let's remove this in a subsequent PR
(probably no need to send a 1 line change)
—
Reply to this email directly, view it on GitHub
<#37 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGM667DVNRXQFL2EM3NUCQD3OXZRHAVCNFSM6AAAAACDH5FECKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTCNBRGUYTONJXGM>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Fixes #36