fix: [CODE-3460]: Update API path for pr update target branch (#3662)

* Revert to PUT for HTTP method
* Merge remote-tracking branch 'origin/main' into dd/target-branch-handler
* Update API path for pr update target branch
This commit is contained in:
Darko Draskovic 2025-04-22 11:36:26 +00:00 committed by Harness
parent 646cb57578
commit a1969452b8
2 changed files with 4 additions and 3 deletions

View File

@ -779,14 +779,14 @@ func pullReqOperations(reflector *openapi3.Reflector) {
_ = reflector.SetRequest(&opChangeTargetBranch, struct {
pullReqRequest
pullreq.ChangeTargetBranchInput
}{}, http.MethodPost)
}{}, http.MethodPut)
_ = reflector.SetJSONResponse(&opChangeTargetBranch, new(types.PullReq), http.StatusOK)
_ = reflector.SetJSONResponse(&opChangeTargetBranch, new(usererror.Error), http.StatusBadRequest)
_ = reflector.SetJSONResponse(&opChangeTargetBranch, new(usererror.Error), http.StatusInternalServerError)
_ = reflector.SetJSONResponse(&opChangeTargetBranch, new(usererror.Error), http.StatusUnauthorized)
_ = reflector.SetJSONResponse(&opChangeTargetBranch, new(usererror.Error), http.StatusForbidden)
_ = reflector.Spec.AddOperation(http.MethodPut,
"/repos/{repo_ref}/pullreq/{pullreq_number}/branch", opChangeTargetBranch)
"/repos/{repo_ref}/pullreq/{pullreq_number}/target-branch", opChangeTargetBranch)
fileViewAdd := openapi3.Operation{}
fileViewAdd.WithTags("pullreq")

View File

@ -696,9 +696,10 @@ func SetupPullReq(r chi.Router, pullreqCtrl *pullreq.Controller) {
r.Route("/branch", func(r chi.Router) {
r.Post("/", handlerpullreq.HandleRestoreBranch(pullreqCtrl))
r.Delete("/", handlerpullreq.HandleDeleteBranch(pullreqCtrl))
r.Put("/", handlerpullreq.HandleChangeTargetBranch(pullreqCtrl))
})
r.Put("/target-branch", handlerpullreq.HandleChangeTargetBranch(pullreqCtrl))
r.Route("/file-views", func(r chi.Router) {
r.Put("/", handlerpullreq.HandleFileViewAdd(pullreqCtrl))
r.Get("/", handlerpullreq.HandleFileViewList(pullreqCtrl))