-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat!: Change AuditEntry.Org and AuditEntry.OrgID to json.RawMessage #3502
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3502 +/- ##
==========================================
+ Coverage 91.21% 91.30% +0.09%
==========================================
Files 182 183 +1
Lines 15930 16095 +165
==========================================
+ Hits 14531 14696 +165
Misses 1225 1225
Partials 174 174 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@antixcode6 - this looks like a great start! Why not add the new getter methods to this PR to keep it all in the same place? I'm thinking that you can add replacements for the original NOTE that your new getters would live right next to the struct defs or method defs... please do NOT put them in the auto-generated files, as they will be constantly overwritten. Thoughts? |
@gmlewis sounds good! I just pushed up some changes with four getters, two raw getters and two for the same result types as before with the added ok. Also I created a test to make sure these getters are covered. |
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.
Thank you, @antixcode6!
Did you want to add new getters for the other types being returned that you discovered?
Otherwise, LGTM.
@gmlewis this covers both Org and OrgID which are the two I discovered to be returning arrays sometimes, otherwise I haven't noticed anything else that would need to be modified |
So you don't want to add getters that return |
…OrgStrings
@gmlewis good suggestions I've made the changes, I also had to fix something in my test case. All should be good now |
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.
Thank you, @antixcode6!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
@stevehipwell - might you have time for a code review? Thank you!
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.
The implementation looks good, but I'm not a fan of json.RawMessage
. Did you consider using a custom marshaller and adding Orgs
& OrgIDs
to take the array versions? I did this or something similar for the ruleset APIs.
Do you want to create an alternative PR and then we can look at the two implementations and decide which one we prefer? |
@gmlewis sorry but I don't think I have the bandwidth to pick up a PR for this now. This is probably a wider discussion than just this PR as GitHub APIs often include types that can't be directly represented by the Go type system. After re-reading the issue I have a slightly different view. The schema is incorrect, which needs to be reported at github/rest-api-description (but I wouldn't hold your breath as it looks as much of a ghost town as the TF provider). And for the implementation as we don't need to directly follow the GitHub API, I think the struct should have |
I'm open to this suggestion. Are you, @antixcode6? |
@gmlewis @stevehipwell I'm open to this, would it make sense to open a separate PR with with the Orgs and OrgIDs fields as part of the struct, and then we can pick the more appropriate change? I have no problem creating a new branch and PR but if it is better to work out of here I am ok with that too. |
Sure, a separate PR makes sense to me. Thank you! |
BREAKING CHANGE:
AuditEntry.Org
andAuditEntry.OrgID
are nowjson.RawMessage
with new getters.Fixes: #3488.
This PR is meant to resolve the issues around #3488
I am modifying
AuditEntry.Org
andAuditEntry.OrgID
from*string
and*int64
, respectively, to both bejson.RawMessage
types this is meant to allow the consumer of this client to test the fields for being a string/int64 or being a []string/[]int64 and handle it accordingly.This PR also modifies the tests
TestOrganizationService_GetAuditLog
TestAuditEntry_Marshal
andTestEnterpriseService_GetAuditLog
to ensure functionality remains after changing the above mentioned fields tojson.RawMessage
I have also added two methods,
AuditEntry.GetOrgID
andAuditEntry.GetOrg
, toskipStructMethods
and ran the code gen to remove the tests and methods to make sure we do not need to modify the generated tests/accessor methods.