fix: [CODE-2478]: fix swagger of webhook execution (#2796)

This commit is contained in:
Abhinav Singh 2024-10-10 00:43:28 +00:00 committed by Harness
parent 966cd70c4a
commit f4659a0c31

View File

@ -199,12 +199,13 @@ func webhookOperations(reflector *openapi3.Reflector) {
retriggerWebhookExecution := openapi3.Operation{}
retriggerWebhookExecution.WithTags("webhook")
retriggerWebhookExecution.WithMapOfAnything(map[string]interface{}{"operationId": "retriggerWebhookExecution"})
_ = reflector.SetRequest(&retriggerWebhookExecution, nil, http.MethodPost)
_ = reflector.SetRequest(&retriggerWebhookExecution, new(webhookExecutionRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&retriggerWebhookExecution, new(types.WebhookExecution), http.StatusOK)
_ = reflector.SetJSONResponse(&retriggerWebhookExecution, new(usererror.Error), http.StatusBadRequest)
_ = reflector.SetJSONResponse(&retriggerWebhookExecution, new(usererror.Error), http.StatusInternalServerError)
_ = reflector.SetJSONResponse(&retriggerWebhookExecution, new(usererror.Error), http.StatusUnauthorized)
_ = reflector.SetJSONResponse(&retriggerWebhookExecution, new(usererror.Error), http.StatusForbidden)
_ = reflector.Spec.AddOperation(http.MethodGet,
"/repos/{repo_ref}/webhooks/{webhook_identifier}/executions/{webhook_execution_id}", retriggerWebhookExecution)
_ = reflector.Spec.AddOperation(http.MethodPost,
"/repos/{repo_ref}/webhooks/{webhook_identifier}/executions/{webhook_execution_id}/retrigger",
retriggerWebhookExecution)
}