Merge pull request #3563 from prometheus/bump-go-swagger-to-latest-stable

Bump: go-swagger to latest stable
This commit is contained in:
Simon Pasquier 2023-10-19 17:06:10 +02:00 committed by GitHub
commit 280a742b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 171 additions and 11 deletions

View File

@ -65,7 +65,7 @@ SWAGGER = docker run \
--user=$(shell id -u $(USER)):$(shell id -g $(USER)) \ --user=$(shell id -u $(USER)):$(shell id -g $(USER)) \
--rm \ --rm \
-v $(shell pwd):/go/src/github.com/prometheus/alertmanager \ -v $(shell pwd):/go/src/github.com/prometheus/alertmanager \
-w /go/src/github.com/prometheus/alertmanager quay.io/goswagger/swagger:v0.30.3 -w /go/src/github.com/prometheus/alertmanager quay.io/goswagger/swagger:v0.30.5
api/v2/models api/v2/restapi api/v2/client: api/v2/openapi.yaml api/v2/models api/v2/restapi api/v2/client: api/v2/openapi.yaml
-rm -r api/v2/{client,models,restapi} -rm -r api/v2/{client,models,restapi}

View File

@ -56,7 +56,7 @@ func (o *GetAlertsReader) ReadResponse(response runtime.ClientResponse, consumer
} }
return nil, result return nil, result
default: default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) return nil, runtime.NewAPIError("[GET /alerts] getAlerts", response, response.Code())
} }
} }
@ -99,6 +99,11 @@ func (o *GetAlertsOK) IsCode(code int) bool {
return code == 200 return code == 200
} }
// Code gets the status code for the get alerts o k response
func (o *GetAlertsOK) Code() int {
return 200
}
func (o *GetAlertsOK) Error() string { func (o *GetAlertsOK) Error() string {
return fmt.Sprintf("[GET /alerts][%d] getAlertsOK %+v", 200, o.Payload) return fmt.Sprintf("[GET /alerts][%d] getAlertsOK %+v", 200, o.Payload)
} }
@ -160,6 +165,11 @@ func (o *GetAlertsBadRequest) IsCode(code int) bool {
return code == 400 return code == 400
} }
// Code gets the status code for the get alerts bad request response
func (o *GetAlertsBadRequest) Code() int {
return 400
}
func (o *GetAlertsBadRequest) Error() string { func (o *GetAlertsBadRequest) Error() string {
return fmt.Sprintf("[GET /alerts][%d] getAlertsBadRequest %+v", 400, o.Payload) return fmt.Sprintf("[GET /alerts][%d] getAlertsBadRequest %+v", 400, o.Payload)
} }
@ -221,6 +231,11 @@ func (o *GetAlertsInternalServerError) IsCode(code int) bool {
return code == 500 return code == 500
} }
// Code gets the status code for the get alerts internal server error response
func (o *GetAlertsInternalServerError) Code() int {
return 500
}
func (o *GetAlertsInternalServerError) Error() string { func (o *GetAlertsInternalServerError) Error() string {
return fmt.Sprintf("[GET /alerts][%d] getAlertsInternalServerError %+v", 500, o.Payload) return fmt.Sprintf("[GET /alerts][%d] getAlertsInternalServerError %+v", 500, o.Payload)
} }

View File

@ -54,7 +54,7 @@ func (o *PostAlertsReader) ReadResponse(response runtime.ClientResponse, consume
} }
return nil, result return nil, result
default: default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) return nil, runtime.NewAPIError("[POST /alerts] postAlerts", response, response.Code())
} }
} }
@ -96,6 +96,11 @@ func (o *PostAlertsOK) IsCode(code int) bool {
return code == 200 return code == 200
} }
// Code gets the status code for the post alerts o k response
func (o *PostAlertsOK) Code() int {
return 200
}
func (o *PostAlertsOK) Error() string { func (o *PostAlertsOK) Error() string {
return fmt.Sprintf("[POST /alerts][%d] postAlertsOK ", 200) return fmt.Sprintf("[POST /alerts][%d] postAlertsOK ", 200)
} }
@ -148,6 +153,11 @@ func (o *PostAlertsBadRequest) IsCode(code int) bool {
return code == 400 return code == 400
} }
// Code gets the status code for the post alerts bad request response
func (o *PostAlertsBadRequest) Code() int {
return 400
}
func (o *PostAlertsBadRequest) Error() string { func (o *PostAlertsBadRequest) Error() string {
return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %+v", 400, o.Payload) return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %+v", 400, o.Payload)
} }
@ -209,6 +219,11 @@ func (o *PostAlertsInternalServerError) IsCode(code int) bool {
return code == 500 return code == 500
} }
// Code gets the status code for the post alerts internal server error response
func (o *PostAlertsInternalServerError) Code() int {
return 500
}
func (o *PostAlertsInternalServerError) Error() string { func (o *PostAlertsInternalServerError) Error() string {
return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %+v", 500, o.Payload) return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %+v", 500, o.Payload)
} }

View File

@ -56,7 +56,7 @@ func (o *GetAlertGroupsReader) ReadResponse(response runtime.ClientResponse, con
} }
return nil, result return nil, result
default: default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) return nil, runtime.NewAPIError("[GET /alerts/groups] getAlertGroups", response, response.Code())
} }
} }
@ -99,6 +99,11 @@ func (o *GetAlertGroupsOK) IsCode(code int) bool {
return code == 200 return code == 200
} }
// Code gets the status code for the get alert groups o k response
func (o *GetAlertGroupsOK) Code() int {
return 200
}
func (o *GetAlertGroupsOK) Error() string { func (o *GetAlertGroupsOK) Error() string {
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %+v", 200, o.Payload) return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %+v", 200, o.Payload)
} }
@ -160,6 +165,11 @@ func (o *GetAlertGroupsBadRequest) IsCode(code int) bool {
return code == 400 return code == 400
} }
// Code gets the status code for the get alert groups bad request response
func (o *GetAlertGroupsBadRequest) Code() int {
return 400
}
func (o *GetAlertGroupsBadRequest) Error() string { func (o *GetAlertGroupsBadRequest) Error() string {
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %+v", 400, o.Payload) return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %+v", 400, o.Payload)
} }
@ -221,6 +231,11 @@ func (o *GetAlertGroupsInternalServerError) IsCode(code int) bool {
return code == 500 return code == 500
} }
// Code gets the status code for the get alert groups internal server error response
func (o *GetAlertGroupsInternalServerError) Code() int {
return 500
}
func (o *GetAlertGroupsInternalServerError) Error() string { func (o *GetAlertGroupsInternalServerError) Error() string {
return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %+v", 500, o.Payload) return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %+v", 500, o.Payload)
} }

View File

@ -44,7 +44,7 @@ func (o *GetStatusReader) ReadResponse(response runtime.ClientResponse, consumer
} }
return result, nil return result, nil
default: default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) return nil, runtime.NewAPIError("[GET /status] getStatus", response, response.Code())
} }
} }
@ -87,6 +87,11 @@ func (o *GetStatusOK) IsCode(code int) bool {
return code == 200 return code == 200
} }
// Code gets the status code for the get status o k response
func (o *GetStatusOK) Code() int {
return 200
}
func (o *GetStatusOK) Error() string { func (o *GetStatusOK) Error() string {
return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload) return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload)
} }

View File

@ -44,7 +44,7 @@ func (o *GetReceiversReader) ReadResponse(response runtime.ClientResponse, consu
} }
return result, nil return result, nil
default: default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) return nil, runtime.NewAPIError("[GET /receivers] getReceivers", response, response.Code())
} }
} }
@ -87,6 +87,11 @@ func (o *GetReceiversOK) IsCode(code int) bool {
return code == 200 return code == 200
} }
// Code gets the status code for the get receivers o k response
func (o *GetReceiversOK) Code() int {
return 200
}
func (o *GetReceiversOK) Error() string { func (o *GetReceiversOK) Error() string {
return fmt.Sprintf("[GET /receivers][%d] getReceiversOK %+v", 200, o.Payload) return fmt.Sprintf("[GET /receivers][%d] getReceiversOK %+v", 200, o.Payload)
} }

View File

@ -54,7 +54,7 @@ func (o *DeleteSilenceReader) ReadResponse(response runtime.ClientResponse, cons
} }
return nil, result return nil, result
default: default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) return nil, runtime.NewAPIError("[DELETE /silence/{silenceID}] deleteSilence", response, response.Code())
} }
} }
@ -96,6 +96,11 @@ func (o *DeleteSilenceOK) IsCode(code int) bool {
return code == 200 return code == 200
} }
// Code gets the status code for the delete silence o k response
func (o *DeleteSilenceOK) Code() int {
return 200
}
func (o *DeleteSilenceOK) Error() string { func (o *DeleteSilenceOK) Error() string {
return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceOK ", 200) return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceOK ", 200)
} }
@ -147,6 +152,11 @@ func (o *DeleteSilenceNotFound) IsCode(code int) bool {
return code == 404 return code == 404
} }
// Code gets the status code for the delete silence not found response
func (o *DeleteSilenceNotFound) Code() int {
return 404
}
func (o *DeleteSilenceNotFound) Error() string { func (o *DeleteSilenceNotFound) Error() string {
return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceNotFound ", 404) return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceNotFound ", 404)
} }
@ -199,6 +209,11 @@ func (o *DeleteSilenceInternalServerError) IsCode(code int) bool {
return code == 500 return code == 500
} }
// Code gets the status code for the delete silence internal server error response
func (o *DeleteSilenceInternalServerError) Code() int {
return 500
}
func (o *DeleteSilenceInternalServerError) Error() string { func (o *DeleteSilenceInternalServerError) Error() string {
return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceInternalServerError %+v", 500, o.Payload) return fmt.Sprintf("[DELETE /silence/{silenceID}][%d] deleteSilenceInternalServerError %+v", 500, o.Payload)
} }

View File

@ -56,7 +56,7 @@ func (o *GetSilenceReader) ReadResponse(response runtime.ClientResponse, consume
} }
return nil, result return nil, result
default: default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) return nil, runtime.NewAPIError("[GET /silence/{silenceID}] getSilence", response, response.Code())
} }
} }
@ -99,6 +99,11 @@ func (o *GetSilenceOK) IsCode(code int) bool {
return code == 200 return code == 200
} }
// Code gets the status code for the get silence o k response
func (o *GetSilenceOK) Code() int {
return 200
}
func (o *GetSilenceOK) Error() string { func (o *GetSilenceOK) Error() string {
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceOK %+v", 200, o.Payload) return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceOK %+v", 200, o.Payload)
} }
@ -161,6 +166,11 @@ func (o *GetSilenceNotFound) IsCode(code int) bool {
return code == 404 return code == 404
} }
// Code gets the status code for the get silence not found response
func (o *GetSilenceNotFound) Code() int {
return 404
}
func (o *GetSilenceNotFound) Error() string { func (o *GetSilenceNotFound) Error() string {
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceNotFound ", 404) return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceNotFound ", 404)
} }
@ -213,6 +223,11 @@ func (o *GetSilenceInternalServerError) IsCode(code int) bool {
return code == 500 return code == 500
} }
// Code gets the status code for the get silence internal server error response
func (o *GetSilenceInternalServerError) Code() int {
return 500
}
func (o *GetSilenceInternalServerError) Error() string { func (o *GetSilenceInternalServerError) Error() string {
return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceInternalServerError %+v", 500, o.Payload) return fmt.Sprintf("[GET /silence/{silenceID}][%d] getSilenceInternalServerError %+v", 500, o.Payload)
} }

View File

@ -50,7 +50,7 @@ func (o *GetSilencesReader) ReadResponse(response runtime.ClientResponse, consum
} }
return nil, result return nil, result
default: default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) return nil, runtime.NewAPIError("[GET /silences] getSilences", response, response.Code())
} }
} }
@ -93,6 +93,11 @@ func (o *GetSilencesOK) IsCode(code int) bool {
return code == 200 return code == 200
} }
// Code gets the status code for the get silences o k response
func (o *GetSilencesOK) Code() int {
return 200
}
func (o *GetSilencesOK) Error() string { func (o *GetSilencesOK) Error() string {
return fmt.Sprintf("[GET /silences][%d] getSilencesOK %+v", 200, o.Payload) return fmt.Sprintf("[GET /silences][%d] getSilencesOK %+v", 200, o.Payload)
} }
@ -154,6 +159,11 @@ func (o *GetSilencesInternalServerError) IsCode(code int) bool {
return code == 500 return code == 500
} }
// Code gets the status code for the get silences internal server error response
func (o *GetSilencesInternalServerError) Code() int {
return 500
}
func (o *GetSilencesInternalServerError) Error() string { func (o *GetSilencesInternalServerError) Error() string {
return fmt.Sprintf("[GET /silences][%d] getSilencesInternalServerError %+v", 500, o.Payload) return fmt.Sprintf("[GET /silences][%d] getSilencesInternalServerError %+v", 500, o.Payload)
} }

View File

@ -56,7 +56,7 @@ func (o *PostSilencesReader) ReadResponse(response runtime.ClientResponse, consu
} }
return nil, result return nil, result
default: default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) return nil, runtime.NewAPIError("[POST /silences] postSilences", response, response.Code())
} }
} }
@ -99,6 +99,11 @@ func (o *PostSilencesOK) IsCode(code int) bool {
return code == 200 return code == 200
} }
// Code gets the status code for the post silences o k response
func (o *PostSilencesOK) Code() int {
return 200
}
func (o *PostSilencesOK) Error() string { func (o *PostSilencesOK) Error() string {
return fmt.Sprintf("[POST /silences][%d] postSilencesOK %+v", 200, o.Payload) return fmt.Sprintf("[POST /silences][%d] postSilencesOK %+v", 200, o.Payload)
} }
@ -162,6 +167,11 @@ func (o *PostSilencesBadRequest) IsCode(code int) bool {
return code == 400 return code == 400
} }
// Code gets the status code for the post silences bad request response
func (o *PostSilencesBadRequest) Code() int {
return 400
}
func (o *PostSilencesBadRequest) Error() string { func (o *PostSilencesBadRequest) Error() string {
return fmt.Sprintf("[POST /silences][%d] postSilencesBadRequest %+v", 400, o.Payload) return fmt.Sprintf("[POST /silences][%d] postSilencesBadRequest %+v", 400, o.Payload)
} }
@ -223,6 +233,11 @@ func (o *PostSilencesNotFound) IsCode(code int) bool {
return code == 404 return code == 404
} }
// Code gets the status code for the post silences not found response
func (o *PostSilencesNotFound) Code() int {
return 404
}
func (o *PostSilencesNotFound) Error() string { func (o *PostSilencesNotFound) Error() string {
return fmt.Sprintf("[POST /silences][%d] postSilencesNotFound %+v", 404, o.Payload) return fmt.Sprintf("[POST /silences][%d] postSilencesNotFound %+v", 404, o.Payload)
} }

View File

@ -163,6 +163,11 @@ func (m *AlertGroup) contextValidateAlerts(ctx context.Context, formats strfmt.R
for i := 0; i < len(m.Alerts); i++ { for i := 0; i < len(m.Alerts); i++ {
if m.Alerts[i] != nil { if m.Alerts[i] != nil {
if swag.IsZero(m.Alerts[i]) { // not required
return nil
}
if err := m.Alerts[i].ContextValidate(ctx, formats); err != nil { if err := m.Alerts[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("alerts" + "." + strconv.Itoa(i)) return ve.ValidateName("alerts" + "." + strconv.Itoa(i))
@ -195,6 +200,7 @@ func (m *AlertGroup) contextValidateLabels(ctx context.Context, formats strfmt.R
func (m *AlertGroup) contextValidateReceiver(ctx context.Context, formats strfmt.Registry) error { func (m *AlertGroup) contextValidateReceiver(ctx context.Context, formats strfmt.Registry) error {
if m.Receiver != nil { if m.Receiver != nil {
if err := m.Receiver.ContextValidate(ctx, formats); err != nil { if err := m.Receiver.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("receiver") return ve.ValidateName("receiver")

View File

@ -68,6 +68,11 @@ func (m AlertGroups) ContextValidate(ctx context.Context, formats strfmt.Registr
for i := 0; i < len(m); i++ { for i := 0; i < len(m); i++ {
if m[i] != nil { if m[i] != nil {
if swag.IsZero(m[i]) { // not required
return nil
}
if err := m[i].ContextValidate(ctx, formats); err != nil { if err := m[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName(strconv.Itoa(i)) return ve.ValidateName(strconv.Itoa(i))

View File

@ -175,6 +175,7 @@ func (m *AlertmanagerStatus) ContextValidate(ctx context.Context, formats strfmt
func (m *AlertmanagerStatus) contextValidateCluster(ctx context.Context, formats strfmt.Registry) error { func (m *AlertmanagerStatus) contextValidateCluster(ctx context.Context, formats strfmt.Registry) error {
if m.Cluster != nil { if m.Cluster != nil {
if err := m.Cluster.ContextValidate(ctx, formats); err != nil { if err := m.Cluster.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("cluster") return ve.ValidateName("cluster")
@ -191,6 +192,7 @@ func (m *AlertmanagerStatus) contextValidateCluster(ctx context.Context, formats
func (m *AlertmanagerStatus) contextValidateConfig(ctx context.Context, formats strfmt.Registry) error { func (m *AlertmanagerStatus) contextValidateConfig(ctx context.Context, formats strfmt.Registry) error {
if m.Config != nil { if m.Config != nil {
if err := m.Config.ContextValidate(ctx, formats); err != nil { if err := m.Config.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("config") return ve.ValidateName("config")
@ -207,6 +209,7 @@ func (m *AlertmanagerStatus) contextValidateConfig(ctx context.Context, formats
func (m *AlertmanagerStatus) contextValidateVersionInfo(ctx context.Context, formats strfmt.Registry) error { func (m *AlertmanagerStatus) contextValidateVersionInfo(ctx context.Context, formats strfmt.Registry) error {
if m.VersionInfo != nil { if m.VersionInfo != nil {
if err := m.VersionInfo.ContextValidate(ctx, formats); err != nil { if err := m.VersionInfo.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("versionInfo") return ve.ValidateName("versionInfo")

View File

@ -156,6 +156,11 @@ func (m *ClusterStatus) contextValidatePeers(ctx context.Context, formats strfmt
for i := 0; i < len(m.Peers); i++ { for i := 0; i < len(m.Peers); i++ {
if m.Peers[i] != nil { if m.Peers[i] != nil {
if swag.IsZero(m.Peers[i]) { // not required
return nil
}
if err := m.Peers[i].ContextValidate(ctx, formats); err != nil { if err := m.Peers[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("peers" + "." + strconv.Itoa(i)) return ve.ValidateName("peers" + "." + strconv.Itoa(i))

View File

@ -366,6 +366,11 @@ func (m *GettableAlert) contextValidateReceivers(ctx context.Context, formats st
for i := 0; i < len(m.Receivers); i++ { for i := 0; i < len(m.Receivers); i++ {
if m.Receivers[i] != nil { if m.Receivers[i] != nil {
if swag.IsZero(m.Receivers[i]) { // not required
return nil
}
if err := m.Receivers[i].ContextValidate(ctx, formats); err != nil { if err := m.Receivers[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("receivers" + "." + strconv.Itoa(i)) return ve.ValidateName("receivers" + "." + strconv.Itoa(i))
@ -384,6 +389,7 @@ func (m *GettableAlert) contextValidateReceivers(ctx context.Context, formats st
func (m *GettableAlert) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { func (m *GettableAlert) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error {
if m.Status != nil { if m.Status != nil {
if err := m.Status.ContextValidate(ctx, formats); err != nil { if err := m.Status.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("status") return ve.ValidateName("status")

View File

@ -68,6 +68,11 @@ func (m GettableAlerts) ContextValidate(ctx context.Context, formats strfmt.Regi
for i := 0; i < len(m); i++ { for i := 0; i < len(m); i++ {
if m[i] != nil { if m[i] != nil {
if swag.IsZero(m[i]) { // not required
return nil
}
if err := m[i].ContextValidate(ctx, formats); err != nil { if err := m[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName(strconv.Itoa(i)) return ve.ValidateName(strconv.Itoa(i))

View File

@ -202,6 +202,7 @@ func (m *GettableSilence) ContextValidate(ctx context.Context, formats strfmt.Re
func (m *GettableSilence) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { func (m *GettableSilence) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error {
if m.Status != nil { if m.Status != nil {
if err := m.Status.ContextValidate(ctx, formats); err != nil { if err := m.Status.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("status") return ve.ValidateName("status")

View File

@ -68,6 +68,11 @@ func (m GettableSilences) ContextValidate(ctx context.Context, formats strfmt.Re
for i := 0; i < len(m); i++ { for i := 0; i < len(m); i++ {
if m[i] != nil { if m[i] != nil {
if swag.IsZero(m[i]) { // not required
return nil
}
if err := m[i].ContextValidate(ctx, formats); err != nil { if err := m[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName(strconv.Itoa(i)) return ve.ValidateName(strconv.Itoa(i))

View File

@ -75,6 +75,11 @@ func (m Matchers) ContextValidate(ctx context.Context, formats strfmt.Registry)
for i := 0; i < len(m); i++ { for i := 0; i < len(m); i++ {
if m[i] != nil { if m[i] != nil {
if swag.IsZero(m[i]) { // not required
return nil
}
if err := m[i].ContextValidate(ctx, formats); err != nil { if err := m[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName(strconv.Itoa(i)) return ve.ValidateName(strconv.Itoa(i))

View File

@ -203,6 +203,10 @@ func (m *PostableAlert) ContextValidate(ctx context.Context, formats strfmt.Regi
func (m *PostableAlert) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error { func (m *PostableAlert) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error {
if swag.IsZero(m.Annotations) { // not required
return nil
}
if err := m.Annotations.ContextValidate(ctx, formats); err != nil { if err := m.Annotations.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("annotations") return ve.ValidateName("annotations")

View File

@ -68,6 +68,11 @@ func (m PostableAlerts) ContextValidate(ctx context.Context, formats strfmt.Regi
for i := 0; i < len(m); i++ { for i := 0; i < len(m); i++ {
if m[i] != nil { if m[i] != nil {
if swag.IsZero(m[i]) { // not required
return nil
}
if err := m[i].ContextValidate(ctx, formats); err != nil { if err := m[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok { if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName(strconv.Itoa(i)) return ve.ValidateName(strconv.Itoa(i))

View File

@ -412,6 +412,6 @@ func (o *AlertmanagerAPI) AddMiddlewareFor(method, path string, builder middlewa
} }
o.Init() o.Init()
if h, ok := o.handlers[um][path]; ok { if h, ok := o.handlers[um][path]; ok {
o.handlers[method][path] = builder(h) o.handlers[um][path] = builder(h)
} }
} }