-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
I genuinely will never understand go mod. The difference in dependencies is produced by running I'm not sure if it's because I have a different set of dependencies or because we forgot to converge at some other point - any pointers? |
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.
No idea about the go mod changes, but would not worry about it looking at it
@@ -119,10 +119,19 @@ type GettableSilences = amv2.GettableSilences | |||
type GettableSilence = amv2.GettableSilence | |||
|
|||
// swagger:model | |||
type GettableAlerts amv2.GettableAlerts | |||
type GettableAlerts = amv2.GettableAlerts |
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.
This is the first time I am seeing type x = y
syntax 😱 how does it work?
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.
Is it equivalent to type x y
?
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 can't find the original article I read on the subject which does a better job at explaining than I do, but it is different. The tl;dr is that type x y
is a type definition, in the eyes of the compiler is a new type just like type X struct { y }
whereas type x = y
is type alias which means is just a different name for the same type (and thus would have the same memory footprint).
In practical terms, this allows us to use our types and the returned AM types interchangeably w/o having to do any type casting. We are not operating on these types so it makes sense.
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 modifications LGTM
I don't know about the go dependencies but I get the same result if run go mod tidy
in master.
Can you please post also the update spec.json
and post.json
?
@papagian on a closer inspection, I found a couple more inconsistencies with the upstream API could I please get another look? |
@@ -106,7 +106,7 @@ type GetDeleteSilenceParams struct { | |||
// swagger:parameters RouteGetSilences | |||
type GetSilencesParams struct { | |||
// in:query | |||
Filter []string | |||
Filter []string `json:"filter"` |
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.
Does this mean that the query parameter will become filter
instead of Filter
in this request, right?
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.
Yep! I have already fixed this with https://github.com/grafana/grafana/pull/32604/files
// in: query | ||
// required: false | ||
Receivers []string `json:"receivers"` | ||
Receivers string `json:"receiver"` |
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.
For reference, these changes are required for conformance with this API route
Update the Alertmanager models to add necessary ones for the
/alerts
and/alerts/groups
endpoints.