diff --git a/internal/api/openapi/repo.go b/internal/api/openapi/repo.go index fcdcd1ae5..6176df444 100644 --- a/internal/api/openapi/repo.go +++ b/internal/api/openapi/repo.go @@ -120,6 +120,11 @@ type listTagsRequest struct { repoRequest } +type getRawDiffRequest struct { + repoRequest + Range string `path:"range" example:"main..dev"` +} + var queryParameterGitRef = openapi3.ParameterOrRef{ Parameter: &openapi3.Parameter{ Name: request.QueryParamGitRef, @@ -434,4 +439,14 @@ func repoOperations(reflector *openapi3.Reflector) { _ = reflector.SetJSONResponse(&opCommitFiles, new(usererror.Error), http.StatusForbidden) _ = reflector.SetJSONResponse(&opCommitFiles, new(usererror.Error), http.StatusNotFound) _ = reflector.Spec.AddOperation(http.MethodPost, "/repos/{repo_ref}/commits", opCommitFiles) + + opRawDiff := openapi3.Operation{} + opRawDiff.WithTags("repository") + opRawDiff.WithMapOfAnything(map[string]interface{}{"operationId": "rawDiff"}) + _ = reflector.SetRequest(&opRawDiff, new(getRawDiffRequest), http.MethodGet) + _ = reflector.SetStringResponse(&opRawDiff, http.StatusOK, "text/plain") + _ = reflector.SetJSONResponse(&opRawDiff, new(usererror.Error), http.StatusInternalServerError) + _ = reflector.SetJSONResponse(&opRawDiff, new(usererror.Error), http.StatusUnauthorized) + _ = reflector.SetJSONResponse(&opRawDiff, new(usererror.Error), http.StatusForbidden) + _ = reflector.Spec.AddOperation(http.MethodGet, "/repos/{repo_ref}/compare/{range}", opRawDiff) }