feat!: Add support for multi-select Custom Properties#3200
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3200 +/- ##
==========================================
- Coverage 97.72% 92.92% -4.80%
==========================================
Files 153 171 +18
Lines 13390 11582 -1808
==========================================
- Hits 13085 10763 -2322
- Misses 215 726 +511
- Partials 90 93 +3 ☔ View full report in Codecov by Sentry. |
|
Yes, if I remember correctly, we handle situations like this in various ways:
So I'm fine with this method. You could additionally define two new structs |
That makes sense, thank you for the explanation and the breakdown. I'm fine with the current solution as is if we want to go with that, at some point I did something similar to having two new structs but ended up deciding to move back to trying the |
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @arymoraes!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
|
Thank you, @valbeat ! |
| switch v := aux.Value.(type) { | ||
| case nil: | ||
| cpv.Value = nil | ||
| case string: |
There was a problem hiding this comment.
Do boolean custom properties come through as a string as well?
There was a problem hiding this comment.
Yes, they come as string from the GitHub API:
{
"property_name": "boolean_prop",
"value": "true"
},
Fixes #3198.
BREAKING CHANGE:
CustomPropertyValue.Valueis changed from*stringtointerface{}to supportstringand[]stringvalues.So the problem here is that the GitHub custom properties
valuecan come in either as astring(for all nonmulti_selectproperties), or as a[]stringin amulti_selectproperty.The issue is happening because we were trying to unmarshal it but always expecting a
stringfor the Value.My solution was to make value an
interface{}type that implements aUnmarshalJSONto handle both scenarios. While this works, we end up losing the auto generatedGetValue()accessor. Another thing I was unsure is that I saw on other places and on the tests for this that we use a pointer to the value, but I changed it to the value itself on the Unmarshal call since we lose the accessor, not sure if this is correct.Another solution I played with was using
json.RawMessage, I could not make it fully work (I can give it another try), but at least we did lose the auto generatedGetValueaccessor there, would this be a more adequate solution?