ngalert openapi: Use same basePath as rest of Grafana (#79025)
* ngalert openapi: Use same `basePath` as rest of Grafana Currently, there are two issues that prevent easily merging `ngalert` and grafana openapi specs: - The basePath is different. `grafana` has `/api` and `ngalert` has `/api/v1`. I changed `ngalert` to use `/api` - The `ngalert` endpoints have their basePath in the each operation path. The basePath should actually be omitted --------- Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
This commit is contained in:
@@ -36,13 +36,13 @@ func (f *{{classname}}Handler) {{nickname}}(ctx *contextmodel.ReqContext) respon
|
||||
func (api *API) Register{{classname}}Endpoints(srv {{classname}}, m *metrics.API) {
|
||||
api.RouteRegister.Group("", func(group routing.RouteRegister){ {{#operations}}{{#operation}}
|
||||
group.{{httpMethod}}(
|
||||
toMacaronPath("{{{path}}}"),
|
||||
toMacaronPath("/api{{{path}}}"),
|
||||
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
||||
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
||||
api.authorize(http.Method{{httpMethod}}, "{{{path}}}"),
|
||||
api.authorize(http.Method{{httpMethod}}, "/api{{{path}}}"),
|
||||
metrics.Instrument(
|
||||
http.Method{{httpMethod}},
|
||||
"{{{path}}}",
|
||||
"/api{{{path}}}",
|
||||
api.Hooks.Wrap(srv.{{nickname}}),
|
||||
m,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user