-
Notifications
You must be signed in to change notification settings - Fork 130
Use optionalField for creation in ExplainSMPolicy serialization #1507
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
base: main
Are you sure you want to change the base?
Use optionalField for creation in ExplainSMPolicy serialization #1507
Conversation
Signed-off-by: Tarun-kishore <[email protected]>
metadata?.let { | ||
builder | ||
.field(SMMetadata.CREATION_FIELD, it.creation) | ||
.optionalField(SMMetadata.CREATION_FIELD, it.creation) |
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.
will this have bwc issue when doing rolling upgrade? guess we need to add version check here
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.
Yes, Good catch. Added a version check.
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.
@Hailong-am I added a version check for greater than 3.3 (which is current version). The coverage is failing though, version 3.4 needs to be available for testing it. Rest all CI workflows are passing.
Signed-off-by: Tarun-kishore <[email protected]>
b07015e
to
5079606
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1507 +/- ##
==========================================
- Coverage 76.47% 76.37% -0.11%
==========================================
Files 375 375
Lines 18835 18838 +3
Branches 2401 2402 +1
==========================================
- Hits 14405 14388 -17
- Misses 3182 3206 +24
+ Partials 1248 1244 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Could you add a test covering this? |
Signed-off-by: Tarun-kishore <[email protected]>
Signed-off-by: Tarun-kishore <[email protected]>
I've added unit test covering the parsing, but unit test cannot change |
Description
Fixed incorrect serialization of the
creation
field inExplainSMPolicy.toXContent()
. The method was using.field()
instead of.optionalField()
for the nullablecreation
field, which is inconsistent with how thedeletion
field is handled and with the reference implementation inSMMetadata.toXContent()
.Changed line 39 in
ExplainSMPolicy.kt
:.field(SMMetadata.CREATION_FIELD, it.creation)
.optionalField(SMMetadata.CREATION_FIELD, it.creation)
This ensures proper handling of null creation workflow metadata in Explain API responses and aligns with the serialization behavior in
SMMetadata
.Related Issues
Resolves #1506
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.