swagger ref added for rawdiff

This commit is contained in:
Enver Bisevac 2023-01-02 10:56:32 +02:00
parent 58a2d90973
commit 72485456ab

View File

@ -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)
}