Skip to content

Commit 087df1d

Browse files
authoredAug 26, 2024
OpenAPI: Fix alerting DeleteMuteTiming errors (grafana#91109)
The `GenericPublicError` is not what is actually returned by the API. Using `PublicError` describes the API correctly
1 parent 0075abe commit 087df1d

File tree

8 files changed

+66
-116
lines changed

8 files changed

+66
-116
lines changed
 

‎pkg/services/ngalert/api/tooling/api.json

+12-21
Original file line numberDiff line numberDiff line change
@@ -1315,14 +1315,6 @@
13151315
"title": "Frames is a slice of Frame pointers.",
13161316
"type": "array"
13171317
},
1318-
"GenericPublicError": {
1319-
"properties": {
1320-
"body": {
1321-
"$ref": "#/definitions/PublicError"
1322-
}
1323-
},
1324-
"type": "object"
1325-
},
13261318
"GettableAlertmanagers": {
13271319
"properties": {
13281320
"data": {
@@ -4583,7 +4575,6 @@
45834575
"type": "object"
45844576
},
45854577
"alertGroups": {
4586-
"description": "AlertGroups alert groups",
45874578
"items": {
45884579
"$ref": "#/definitions/alertGroup",
45894580
"type": "object"
@@ -5919,9 +5910,9 @@
59195910
"description": " The mute timing was deleted successfully."
59205911
},
59215912
"409": {
5922-
"description": "GenericPublicError",
5913+
"description": "PublicError",
59235914
"schema": {
5924-
"$ref": "#/definitions/GenericPublicError"
5915+
"$ref": "#/definitions/PublicError"
59255916
}
59265917
}
59275918
},
@@ -5997,9 +5988,9 @@
59975988
}
59985989
},
59995990
"409": {
6000-
"description": "GenericPublicError",
5991+
"description": "PublicError",
60015992
"schema": {
6002-
"$ref": "#/definitions/GenericPublicError"
5993+
"$ref": "#/definitions/PublicError"
60035994
}
60045995
}
60055996
},
@@ -6211,9 +6202,9 @@
62116202
"description": " The template was deleted successfully."
62126203
},
62136204
"409": {
6214-
"description": "GenericPublicError",
6205+
"description": "PublicError",
62156206
"schema": {
6216-
"$ref": "#/definitions/GenericPublicError"
6207+
"$ref": "#/definitions/PublicError"
62176208
}
62186209
}
62196210
},
@@ -6241,9 +6232,9 @@
62416232
}
62426233
},
62436234
"404": {
6244-
"description": "GenericPublicError",
6235+
"description": "PublicError",
62456236
"schema": {
6246-
"$ref": "#/definitions/GenericPublicError"
6237+
"$ref": "#/definitions/PublicError"
62476238
}
62486239
}
62496240
},
@@ -6286,15 +6277,15 @@
62866277
}
62876278
},
62886279
"400": {
6289-
"description": "GenericPublicError",
6280+
"description": "PublicError",
62906281
"schema": {
6291-
"$ref": "#/definitions/GenericPublicError"
6282+
"$ref": "#/definitions/PublicError"
62926283
}
62936284
},
62946285
"409": {
6295-
"description": "GenericPublicError",
6286+
"description": "PublicError",
62966287
"schema": {
6297-
"$ref": "#/definitions/GenericPublicError"
6288+
"$ref": "#/definitions/PublicError"
62986289
}
62996290
}
63006291
},

‎pkg/services/ngalert/api/tooling/definitions/provisioning_mute_timings.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ import (
7070
// Responses:
7171
// 202: MuteTimeInterval
7272
// 400: ValidationError
73-
// 409: GenericPublicError
73+
// 409: PublicError
7474

7575
// swagger:route DELETE /v1/provisioning/mute-timings/{name} provisioning stable RouteDeleteMuteTiming
7676
//
7777
// Delete a mute timing.
7878
//
7979
// Responses:
8080
// 204: description: The mute timing was deleted successfully.
81-
// 409: GenericPublicError
81+
// 409: PublicError
8282

8383
// swagger:route
8484

‎pkg/services/ngalert/api/tooling/definitions/provisioning_templates.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ package definitions
1313
//
1414
// Responses:
1515
// 200: NotificationTemplate
16-
// 404: GenericPublicError
16+
// 404: PublicError
1717

1818
// swagger:route PUT /v1/provisioning/templates/{name} provisioning stable RoutePutTemplate
1919
//
@@ -24,16 +24,16 @@ package definitions
2424
//
2525
// Responses:
2626
// 202: NotificationTemplate
27-
// 400: GenericPublicError
28-
// 409: GenericPublicError
27+
// 400: PublicError
28+
// 409: PublicError
2929

3030
// swagger:route DELETE /v1/provisioning/templates/{name} provisioning stable RouteDeleteTemplate
3131
//
3232
// Delete a template.
3333
//
3434
// Responses:
3535
// 204: description: The template was deleted successfully.
36-
// 409: GenericPublicError
36+
// 409: PublicError
3737

3838
// swagger:parameters RouteGetTemplate RoutePutTemplate RouteDeleteTemplate
3939
type RouteGetTemplateParam struct {

‎pkg/services/ngalert/api/tooling/definitions/shared.go

-7
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,3 @@ type ForbiddenError struct {
2020
// in: body
2121
Body errutil.PublicError `json:"body"`
2222
}
23-
24-
// swagger:model
25-
type GenericPublicError struct {
26-
// The response message
27-
// in: body
28-
Body errutil.PublicError `json:"body"`
29-
}

‎pkg/services/ngalert/api/tooling/post.json

+12-20
Original file line numberDiff line numberDiff line change
@@ -1315,14 +1315,6 @@
13151315
"title": "Frames is a slice of Frame pointers.",
13161316
"type": "array"
13171317
},
1318-
"GenericPublicError": {
1319-
"properties": {
1320-
"body": {
1321-
"$ref": "#/definitions/PublicError"
1322-
}
1323-
},
1324-
"type": "object"
1325-
},
13261318
"GettableAlertmanagers": {
13271319
"properties": {
13281320
"data": {
@@ -8130,9 +8122,9 @@
81308122
"description": " The mute timing was deleted successfully."
81318123
},
81328124
"409": {
8133-
"description": "GenericPublicError",
8125+
"description": "PublicError",
81348126
"schema": {
8135-
"$ref": "#/definitions/GenericPublicError"
8127+
"$ref": "#/definitions/PublicError"
81368128
}
81378129
}
81388130
},
@@ -8208,9 +8200,9 @@
82088200
}
82098201
},
82108202
"409": {
8211-
"description": "GenericPublicError",
8203+
"description": "PublicError",
82128204
"schema": {
8213-
"$ref": "#/definitions/GenericPublicError"
8205+
"$ref": "#/definitions/PublicError"
82148206
}
82158207
}
82168208
},
@@ -8422,9 +8414,9 @@
84228414
"description": " The template was deleted successfully."
84238415
},
84248416
"409": {
8425-
"description": "GenericPublicError",
8417+
"description": "PublicError",
84268418
"schema": {
8427-
"$ref": "#/definitions/GenericPublicError"
8419+
"$ref": "#/definitions/PublicError"
84288420
}
84298421
}
84308422
},
@@ -8452,9 +8444,9 @@
84528444
}
84538445
},
84548446
"404": {
8455-
"description": "GenericPublicError",
8447+
"description": "PublicError",
84568448
"schema": {
8457-
"$ref": "#/definitions/GenericPublicError"
8449+
"$ref": "#/definitions/PublicError"
84588450
}
84598451
}
84608452
},
@@ -8497,15 +8489,15 @@
84978489
}
84988490
},
84998491
"400": {
8500-
"description": "GenericPublicError",
8492+
"description": "PublicError",
85018493
"schema": {
8502-
"$ref": "#/definitions/GenericPublicError"
8494+
"$ref": "#/definitions/PublicError"
85038495
}
85048496
},
85058497
"409": {
8506-
"description": "GenericPublicError",
8498+
"description": "PublicError",
85078499
"schema": {
8508-
"$ref": "#/definitions/GenericPublicError"
8500+
"$ref": "#/definitions/PublicError"
85098501
}
85108502
}
85118503
},

‎pkg/services/ngalert/api/tooling/spec.json

+12-20
Original file line numberDiff line numberDiff line change
@@ -3086,9 +3086,9 @@
30863086
}
30873087
},
30883088
"409": {
3089-
"description": "GenericPublicError",
3089+
"description": "PublicError",
30903090
"schema": {
3091-
"$ref": "#/definitions/GenericPublicError"
3091+
"$ref": "#/definitions/PublicError"
30923092
}
30933093
}
30943094
}
@@ -3125,9 +3125,9 @@
31253125
"description": " The mute timing was deleted successfully."
31263126
},
31273127
"409": {
3128-
"description": "GenericPublicError",
3128+
"description": "PublicError",
31293129
"schema": {
3130-
"$ref": "#/definitions/GenericPublicError"
3130+
"$ref": "#/definitions/PublicError"
31313131
}
31323132
}
31333133
}
@@ -3343,9 +3343,9 @@
33433343
}
33443344
},
33453345
"404": {
3346-
"description": "GenericPublicError",
3346+
"description": "PublicError",
33473347
"schema": {
3348-
"$ref": "#/definitions/GenericPublicError"
3348+
"$ref": "#/definitions/PublicError"
33493349
}
33503350
}
33513351
}
@@ -3389,15 +3389,15 @@
33893389
}
33903390
},
33913391
"400": {
3392-
"description": "GenericPublicError",
3392+
"description": "PublicError",
33933393
"schema": {
3394-
"$ref": "#/definitions/GenericPublicError"
3394+
"$ref": "#/definitions/PublicError"
33953395
}
33963396
},
33973397
"409": {
3398-
"description": "GenericPublicError",
3398+
"description": "PublicError",
33993399
"schema": {
3400-
"$ref": "#/definitions/GenericPublicError"
3400+
"$ref": "#/definitions/PublicError"
34013401
}
34023402
}
34033403
}
@@ -3429,9 +3429,9 @@
34293429
"description": " The template was deleted successfully."
34303430
},
34313431
"409": {
3432-
"description": "GenericPublicError",
3432+
"description": "PublicError",
34333433
"schema": {
3434-
"$ref": "#/definitions/GenericPublicError"
3434+
"$ref": "#/definitions/PublicError"
34353435
}
34363436
}
34373437
}
@@ -4947,14 +4947,6 @@
49474947
"$ref": "#/definitions/Frame"
49484948
}
49494949
},
4950-
"GenericPublicError": {
4951-
"type": "object",
4952-
"properties": {
4953-
"body": {
4954-
"$ref": "#/definitions/PublicError"
4955-
}
4956-
}
4957-
},
49584950
"GettableAlertmanagers": {
49594951
"type": "object",
49604952
"properties": {

0 commit comments

Comments
 (0)
Failed to load comments.