feat: [CODE-4627]: add modernize tool (#4668)

* 3aef45 rebase with main

* 0e1fbb use omitzero go1.24 feature for non pointer structs

* f7254b add modernize tool
This commit is contained in:
Enver Biševac 2025-10-29 14:06:35 +00:00 committed by Harness
parent a93f6cd627
commit 9e6cc3813a
300 changed files with 1076 additions and 1159 deletions

View File

@ -18,7 +18,7 @@ RUN yarn && yarn build && yarn cache clean
# ---------------------------------------------------------#
# Build Harness image #
# ---------------------------------------------------------#
FROM --platform=$BUILDPLATFORM golang:1.23.10-alpine3.22 as builder
FROM --platform=$BUILDPLATFORM golang:1.24.9-alpine3.22 as builder
RUN apk update \
&& apk add --no-cache protoc build-base git

View File

@ -8,7 +8,7 @@ FROM --platform=linux/arm64 harness/opensource-ui:standalone.alpha.480 as uiv2
# ---------------------------------------------------------#
# Build Harness image #
# ---------------------------------------------------------#
FROM --platform=$BUILDPLATFORM golang:1.23.10-alpine3.22 as builder
FROM --platform=$BUILDPLATFORM golang:1.24.9-alpine3.22 as builder
RUN apk update \
&& apk add --no-cache protoc build-base git

View File

@ -118,6 +118,10 @@ format: tools # Format go code and error if any changes are made
@gci write --skip-generated --custom-order -s standard -s "prefix(github.com/harness/gitness)" -s default -s blank -s dot .
@echo "Formatting complete"
modernize:
@echo "Modernizing ..."
@go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...
sec:
@echo "Vulnerability detection $(1)"
@govulncheck ./...

View File

@ -113,7 +113,7 @@ func CheckRepoState(
defaultAllowedPermissions := permissionsAllowedPerRepoState[repo.State]
if !slices.Contains(defaultAllowedPermissions, reqPermission) {
return errors.PreconditionFailed("Operation is not allowed for repository in state %s", repo.State)
return errors.PreconditionFailedf("Operation is not allowed for repository in state %s", repo.State)
}
return nil

View File

@ -51,7 +51,7 @@ func (c *Controller) ListAllGitspaces( // nolint:gocognit
}
var spacesMap = make(map[int64]string)
for idx := 0; idx < len(allGitspaceConfigs); idx++ {
for idx := range allGitspaceConfigs {
if spacesMap[allGitspaceConfigs[idx].SpaceID] == "" {
space, findSpaceErr := c.spaceFinder.FindByRef(ctx, allGitspaceConfigs[idx].SpacePath)
if findSpaceErr != nil {
@ -116,7 +116,7 @@ func (c *Controller) getAuthorizedGitspaceConfigs(
authorizedSpaceIDs map[int64]bool,
) []*types.GitspaceConfig {
var authorizedGitspaceConfigs = make([]*types.GitspaceConfig, 0)
for idx := 0; idx < len(allGitspaceConfigs); idx++ {
for idx := range allGitspaceConfigs {
if authorizedSpaceIDs[allGitspaceConfigs[idx].SpaceID] {
authorizedGitspaceConfigs = append(authorizedGitspaceConfigs, allGitspaceConfigs[idx])
}

View File

@ -17,6 +17,7 @@ package keywordsearch
import (
"context"
"fmt"
"maps"
"math"
"github.com/harness/gitness/app/api/usererror"
@ -51,9 +52,7 @@ func (c *Controller) Search(
return types.SearchResult{}, fmt.Errorf("failed to search repos by space path: %w", err)
}
for repoID, repoPath := range spaceRepoIDToPathMap {
repoIDToPathMap[repoID] = repoPath
}
maps.Copy(repoIDToPathMap, spaceRepoIDToPathMap)
if len(repoIDToPathMap) == 0 {
return types.SearchResult{}, usererror.NotFound("No repositories found")
@ -119,9 +118,7 @@ func (c *Controller) getReposBySpacePaths(
return nil, fmt.Errorf("failed to search repos by space path: %w", err)
}
for repoID, repoPath := range m {
repoIDToPathMap[repoID] = repoPath
}
maps.Copy(repoIDToPathMap, m)
}
return repoIDToPathMap, nil
}

View File

@ -17,6 +17,7 @@ package migrate
import (
"context"
"fmt"
"slices"
"github.com/harness/gitness/app/api/usererror"
"github.com/harness/gitness/app/auth"
@ -78,10 +79,8 @@ func stateTransitionValid(
newState enum.RepoState,
force bool,
) bool {
for _, validState := range validTransitions[currentState] {
if validState == newState {
return true
}
if slices.Contains(validTransitions[currentState], newState) {
return true
}
if force {

View File

@ -67,7 +67,7 @@ func (c *Controller) ChangeTargetBranch(ctx context.Context,
if pr.SourceRepoID != nil && pr.TargetRepoID == *pr.SourceRepoID && pr.SourceBranch == in.BranchName {
return nil,
errors.InvalidArgument("Source branch %q is same as new target branch", pr.SourceBranch)
errors.InvalidArgumentf("Source branch %q is same as new target branch", pr.SourceBranch)
}
readParams := git.CreateReadParams(repo)

View File

@ -55,7 +55,7 @@ func (c *Controller) RestoreBranch(ctx context.Context,
return types.CreateBranchOutput{}, nil, fmt.Errorf("failed to get pull request by number: %w", err)
}
if pr.State == enum.PullReqStateOpen {
return types.CreateBranchOutput{}, nil, errors.Conflict("source branch %q already exists", pr.SourceBranch)
return types.CreateBranchOutput{}, nil, errors.Conflictf("source branch %q already exists", pr.SourceBranch)
}
rules, isRepoOwner, err := c.fetchRules(ctx, session, repo)

View File

@ -256,12 +256,12 @@ func (c *Controller) CommentApplySuggestions(
Action: git.PatchTextAction,
Path: cc.Path,
SHA: fileSHA,
Payload: []byte(fmt.Sprintf(
Payload: fmt.Appendf(nil,
"%d:%d\u0000%s",
cc.LineNew,
cc.LineNew+cc.SpanNew,
suggestionToApply.code,
)),
),
})
activityUpdates[activity.ID] = activityUpdate{

View File

@ -88,7 +88,7 @@ func (c *Controller) Revert(
return nil, fmt.Errorf("failed to get revert branch: %w", err)
}
if err == nil {
return nil, errors.InvalidArgument("Branch %q already exists.", revertBranch)
return nil, errors.InvalidArgumentf("Branch %q already exists.", revertBranch)
}
title := in.Title

View File

@ -325,6 +325,6 @@ func mapNodeModeToContentType(m git.TreeNodeMode) (ContentType, error) {
case git.TreeNodeModeTree:
return ContentTypeDir, nil
default:
return ContentTypeFile, errors.Internal(nil, "unsupported tree node mode '%s'", m)
return ContentTypeFile, errors.Internalf(nil, "unsupported tree node mode '%s'", m)
}
}

View File

@ -83,7 +83,7 @@ func (c *Controller) ForkSync(
}
if !branchForkInfo.SHA.Equal(in.BranchCommitSHA) {
return nil, errors.InvalidArgument("The commit %s isn't the latest commit on the branch %s",
return nil, errors.InvalidArgumentf("The commit %s isn't the latest commit on the branch %s",
in.BranchCommitSHA, in.Branch)
}

View File

@ -35,7 +35,7 @@ func (c *Controller) GetUsageMetrics(
) (*types.UsageMetric, error) {
rootSpaceRef, sub, err := paths.DisectRoot(spaceRef)
if sub != "" {
return nil, errors.InvalidArgument(
return nil, errors.InvalidArgumentf(
"metric api can be used only within %q space: please remove %q part",
rootSpaceRef, sub,
)

View File

@ -36,7 +36,7 @@ type TxOptionResetFunc func()
func TxOptLock(ctx context.Context,
tx dbtx.Transactor,
txFn func(ctx context.Context) error,
opts ...interface{},
opts ...any,
) (err error) {
tries := 5
var resetFuncs []func()

View File

@ -82,7 +82,7 @@ func (c *Controller) CreatePublicKey(
}
if in.Scheme != "" && key.Scheme() != in.Scheme {
return nil, errors.InvalidArgument("key is not a valid %s key", in.Scheme)
return nil, errors.InvalidArgumentf("key is not a valid %s key", in.Scheme)
}
switch key.Scheme() {

View File

@ -85,7 +85,7 @@ func processGitRequest(r *http.Request) (bool, error) {
if strings.HasSuffix(urlPath, infoRefsPath) && r.URL.Query().Has(serviceParam) {
service := r.URL.Query().Get(serviceParam)
if !slices.Contains(allowedServices, service) {
return false, errors.InvalidArgument("git request allows only %v service, got: %s",
return false, errors.InvalidArgumentf("git request allows only %v service, got: %s",
allowedServices, service)
}
return pathTerminatedWithMarkerAndURL(r, "", infoRefsPath, infoRefsPath, urlPath)

View File

@ -126,7 +126,7 @@ func TestNoCacheWithMultipleRequests(t *testing.T) {
middleware := NoCache(handler)
// Make multiple requests to ensure middleware is reusable
for i := 0; i < 3; i++ {
for i := range 3 {
req := httptest.NewRequest(http.MethodGet, "/test", nil)
rec := httptest.NewRecorder()

View File

@ -57,7 +57,7 @@ func buildAccount(reflector *openapi3.Reflector) {
onLogin := openapi3.Operation{}
onLogin.WithTags("account")
onLogin.WithParameters(queryParameterIncludeCookie)
onLogin.WithMapOfAnything(map[string]interface{}{"operationId": "onLogin"})
onLogin.WithMapOfAnything(map[string]any{"operationId": "onLogin"})
_ = reflector.SetRequest(&onLogin, new(loginRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&onLogin, new(types.TokenResponse), http.StatusOK)
_ = reflector.SetJSONResponse(&onLogin, new(usererror.Error), http.StatusBadRequest)
@ -67,7 +67,7 @@ func buildAccount(reflector *openapi3.Reflector) {
opLogout := openapi3.Operation{}
opLogout.WithTags("account")
opLogout.WithMapOfAnything(map[string]interface{}{"operationId": "opLogout"})
opLogout.WithMapOfAnything(map[string]any{"operationId": "opLogout"})
_ = reflector.SetRequest(&opLogout, nil, http.MethodPost)
_ = reflector.SetJSONResponse(&opLogout, nil, http.StatusOK)
_ = reflector.SetJSONResponse(&opLogout, new(usererror.Error), http.StatusBadRequest)
@ -78,7 +78,7 @@ func buildAccount(reflector *openapi3.Reflector) {
onRegister := openapi3.Operation{}
onRegister.WithTags("account")
onRegister.WithParameters(queryParameterIncludeCookie)
onRegister.WithMapOfAnything(map[string]interface{}{"operationId": "onRegister"})
onRegister.WithMapOfAnything(map[string]any{"operationId": "onRegister"})
_ = reflector.SetRequest(&onRegister, new(registerRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&onRegister, new(types.TokenResponse), http.StatusOK)
_ = reflector.SetJSONResponse(&onRegister, new(usererror.Error), http.StatusInternalServerError)

View File

@ -59,7 +59,7 @@ func checkOperations(reflector *openapi3.Reflector) {
reportStatusCheckResults := openapi3.Operation{}
reportStatusCheckResults.WithTags(tag)
reportStatusCheckResults.WithMapOfAnything(map[string]interface{}{"operationId": "reportStatusCheckResults"})
reportStatusCheckResults.WithMapOfAnything(map[string]any{"operationId": "reportStatusCheckResults"})
_ = reflector.SetRequest(&reportStatusCheckResults, struct {
repoRequest
CommitSHA string `path:"commit_sha"`
@ -77,7 +77,7 @@ func checkOperations(reflector *openapi3.Reflector) {
listStatusCheckResults.WithTags(tag)
listStatusCheckResults.WithParameters(
QueryParameterPage, QueryParameterLimit, queryParameterStatusCheckQuery)
listStatusCheckResults.WithMapOfAnything(map[string]interface{}{"operationId": "listStatusCheckResults"})
listStatusCheckResults.WithMapOfAnything(map[string]any{"operationId": "listStatusCheckResults"})
_ = reflector.SetRequest(&listStatusCheckResults, struct {
repoRequest
CommitSHA string `path:"commit_sha"`
@ -94,7 +94,7 @@ func checkOperations(reflector *openapi3.Reflector) {
listStatusCheckRecent.WithTags(tag)
listStatusCheckRecent.WithParameters(
queryParameterStatusCheckQuery, queryParameterStatusCheckSince)
listStatusCheckRecent.WithMapOfAnything(map[string]interface{}{"operationId": "listStatusCheckRecent"})
listStatusCheckRecent.WithMapOfAnything(map[string]any{"operationId": "listStatusCheckRecent"})
_ = reflector.SetRequest(&listStatusCheckRecent, struct {
repoRequest
Since int
@ -111,7 +111,7 @@ func checkOperations(reflector *openapi3.Reflector) {
listStatusCheckRecentSpace.WithTags(tag)
listStatusCheckRecentSpace.WithParameters(
queryParameterStatusCheckQuery, queryParameterStatusCheckSince, QueryParameterRecursive)
listStatusCheckRecentSpace.WithMapOfAnything(map[string]interface{}{"operationId": "listStatusCheckRecentSpace"})
listStatusCheckRecentSpace.WithMapOfAnything(map[string]any{"operationId": "listStatusCheckRecentSpace"})
_ = reflector.SetRequest(&listStatusCheckRecentSpace, struct {
spaceRequest
Since int

View File

@ -26,7 +26,7 @@ func ptrSchemaType(t openapi3.SchemaType) *openapi3.SchemaType {
return &t
}
func ptrptr(i interface{}) *interface{} {
func ptrptr(i any) *any {
return &i
}
@ -56,7 +56,7 @@ var queryParameterOrder = openapi3.ParameterOrRef{
Schema: &openapi3.Schema{
Type: ptrSchemaType(openapi3.SchemaTypeString),
Default: ptrptr(enum.OrderDesc.String()),
Enum: []interface{}{
Enum: []any{
ptr.String(enum.OrderAsc.String()),
ptr.String(enum.OrderDesc.String()),
},

View File

@ -44,7 +44,7 @@ type updateConnectorRequest struct {
func connectorOperations(reflector *openapi3.Reflector) {
opCreate := openapi3.Operation{}
opCreate.WithTags("connector")
opCreate.WithMapOfAnything(map[string]interface{}{"operationId": "createConnector"})
opCreate.WithMapOfAnything(map[string]any{"operationId": "createConnector"})
_ = reflector.SetRequest(&opCreate, new(createConnectorRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreate, new(types.Connector), http.StatusCreated)
_ = reflector.SetJSONResponse(&opCreate, new(usererror.Error), http.StatusBadRequest)
@ -55,7 +55,7 @@ func connectorOperations(reflector *openapi3.Reflector) {
opFind := openapi3.Operation{}
opFind.WithTags("connector")
opFind.WithMapOfAnything(map[string]interface{}{"operationId": "findConnector"})
opFind.WithMapOfAnything(map[string]any{"operationId": "findConnector"})
_ = reflector.SetRequest(&opFind, new(getConnectorRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opFind, new(types.Connector), http.StatusOK)
_ = reflector.SetJSONResponse(&opFind, new(usererror.Error), http.StatusInternalServerError)
@ -66,7 +66,7 @@ func connectorOperations(reflector *openapi3.Reflector) {
opDelete := openapi3.Operation{}
opDelete.WithTags("connector")
opDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deleteConnector"})
opDelete.WithMapOfAnything(map[string]any{"operationId": "deleteConnector"})
_ = reflector.SetRequest(&opDelete, new(getConnectorRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&opDelete, new(usererror.Error), http.StatusInternalServerError)
@ -77,7 +77,7 @@ func connectorOperations(reflector *openapi3.Reflector) {
opUpdate := openapi3.Operation{}
opUpdate.WithTags("connector")
opUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "updateConnector"})
opUpdate.WithMapOfAnything(map[string]any{"operationId": "updateConnector"})
_ = reflector.SetRequest(&opUpdate, new(updateConnectorRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&opUpdate, new(types.Connector), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdate, new(usererror.Error), http.StatusBadRequest)
@ -89,7 +89,7 @@ func connectorOperations(reflector *openapi3.Reflector) {
opTest := openapi3.Operation{}
opTest.WithTags("connector")
opTest.WithMapOfAnything(map[string]interface{}{"operationId": "testConnector"})
opTest.WithMapOfAnything(map[string]any{"operationId": "testConnector"})
_ = reflector.SetRequest(&opTest, nil, http.MethodPost)
_ = reflector.SetJSONResponse(&opTest, new(types.ConnectorTestResponse), http.StatusOK)
_ = reflector.SetJSONResponse(&opTest, new(usererror.Error), http.StatusBadRequest)

View File

@ -89,7 +89,7 @@ func gitspaceOperations(reflector *openapi3.Reflector) {
opCreate := openapi3.Operation{}
opCreate.WithTags("gitspaces")
opCreate.WithSummary("Create gitspace config")
opCreate.WithMapOfAnything(map[string]interface{}{"operationId": "createGitspace"})
opCreate.WithMapOfAnything(map[string]any{"operationId": "createGitspace"})
_ = reflector.SetRequest(&opCreate, new(createGitspaceRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreate, new(types.GitspaceConfig), http.StatusCreated)
_ = reflector.SetJSONResponse(&opCreate, new(usererror.Error), http.StatusBadRequest)
@ -101,7 +101,7 @@ func gitspaceOperations(reflector *openapi3.Reflector) {
opUpdate := openapi3.Operation{}
opUpdate.WithTags("gitspaces")
opUpdate.WithSummary("Update gitspace config")
opUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "updateGitspace"})
opUpdate.WithMapOfAnything(map[string]any{"operationId": "updateGitspace"})
_ = reflector.SetRequest(&opUpdate, new(updateGitspaceRequest), http.MethodPut)
_ = reflector.SetJSONResponse(&opUpdate, new(types.GitspaceConfig), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdate, new(usererror.Error), http.StatusBadRequest)
@ -114,7 +114,7 @@ func gitspaceOperations(reflector *openapi3.Reflector) {
opFind := openapi3.Operation{}
opFind.WithTags("gitspaces")
opFind.WithSummary("Get gitspace")
opFind.WithMapOfAnything(map[string]interface{}{"operationId": "findGitspace"})
opFind.WithMapOfAnything(map[string]any{"operationId": "findGitspace"})
_ = reflector.SetRequest(&opFind, new(getGitspaceRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opFind, new(types.GitspaceConfig), http.StatusOK)
_ = reflector.SetJSONResponse(&opFind, new(usererror.Error), http.StatusInternalServerError)
@ -126,7 +126,7 @@ func gitspaceOperations(reflector *openapi3.Reflector) {
opDelete := openapi3.Operation{}
opDelete.WithTags("gitspaces")
opDelete.WithSummary("Delete gitspace config")
opDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deleteGitspace"})
opDelete.WithMapOfAnything(map[string]any{"operationId": "deleteGitspace"})
_ = reflector.SetRequest(&opDelete, new(getGitspaceRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&opDelete, nil, http.StatusNoContent)
@ -140,7 +140,7 @@ func gitspaceOperations(reflector *openapi3.Reflector) {
opList := openapi3.Operation{}
opList.WithTags("gitspaces")
opList.WithSummary("List gitspaces")
opList.WithMapOfAnything(map[string]interface{}{"operationId": "listGitspaces"})
opList.WithMapOfAnything(map[string]any{"operationId": "listGitspaces"})
opList.WithParameters(QueryParameterQueryGitspace)
_ = reflector.SetRequest(&opList, new(gitspacesListRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opList, new([]*types.GitspaceConfig), http.StatusOK)
@ -152,7 +152,7 @@ func gitspaceOperations(reflector *openapi3.Reflector) {
opEventList := openapi3.Operation{}
opEventList.WithTags("gitspaces")
opEventList.WithSummary("List gitspace events")
opEventList.WithMapOfAnything(map[string]interface{}{"operationId": "listGitspaceEvents"})
opEventList.WithMapOfAnything(map[string]any{"operationId": "listGitspaceEvents"})
_ = reflector.SetRequest(&opEventList, new(gitspaceEventsListRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opEventList, new([]*types.GitspaceEventResponse), http.StatusOK)
_ = reflector.SetJSONResponse(&opEventList, new(usererror.Error), http.StatusBadRequest)
@ -163,7 +163,7 @@ func gitspaceOperations(reflector *openapi3.Reflector) {
opStreamLogs := openapi3.Operation{}
opStreamLogs.WithTags("gitspaces")
opStreamLogs.WithSummary("Stream gitspace logs")
opStreamLogs.WithMapOfAnything(map[string]interface{}{"operationId": "opStreamLogs"})
opStreamLogs.WithMapOfAnything(map[string]any{"operationId": "opStreamLogs"})
_ = reflector.SetRequest(&opStreamLogs, new(gitspaceRequest), http.MethodGet)
_ = reflector.SetStringResponse(&opStreamLogs, http.StatusOK, "text/event-stream")
_ = reflector.SetJSONResponse(&opStreamLogs, []*livelog.Line{}, http.StatusOK)
@ -175,7 +175,7 @@ func gitspaceOperations(reflector *openapi3.Reflector) {
opRepoLookup := openapi3.Operation{}
opRepoLookup.WithTags("gitspaces")
opRepoLookup.WithSummary("Validate git repo for gitspaces")
opRepoLookup.WithMapOfAnything(map[string]interface{}{"operationId": "repoLookupForGitspace"})
opRepoLookup.WithMapOfAnything(map[string]any{"operationId": "repoLookupForGitspace"})
_ = reflector.SetRequest(&opRepoLookup, new(lookupRepoGitspaceRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opRepoLookup, new(scm.CodeRepositoryResponse), http.StatusCreated)
_ = reflector.SetJSONResponse(&opRepoLookup, new(usererror.Error), http.StatusBadRequest)
@ -187,7 +187,7 @@ func gitspaceOperations(reflector *openapi3.Reflector) {
opListAll := openapi3.Operation{}
opListAll.WithTags("gitspaces")
opListAll.WithSummary("List all gitspaces")
opListAll.WithMapOfAnything(map[string]interface{}{"operationId": "listAllGitspaces"})
opListAll.WithMapOfAnything(map[string]any{"operationId": "listAllGitspaces"})
_ = reflector.SetRequest(&opListAll, new(gitspacesListAllRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opListAll, new([]*types.GitspaceConfig), http.StatusOK)
_ = reflector.SetJSONResponse(&opListAll, new(usererror.Error), http.StatusBadRequest)
@ -198,7 +198,7 @@ func gitspaceOperations(reflector *openapi3.Reflector) {
opAction := openapi3.Operation{}
opAction.WithTags("gitspaces")
opAction.WithSummary("Perform action on a gitspace")
opAction.WithMapOfAnything(map[string]interface{}{"operationId": "actionOnGitspace"})
opAction.WithMapOfAnything(map[string]any{"operationId": "actionOnGitspace"})
_ = reflector.SetRequest(&opAction, new(actionGitspaceRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opAction, new(types.GitspaceConfig), http.StatusOK)
_ = reflector.SetJSONResponse(&opAction, new(usererror.Error), http.StatusBadRequest)

View File

@ -36,7 +36,7 @@ func infraProviderOperations(reflector *openapi3.Reflector) {
opFind := openapi3.Operation{}
opFind.WithTags("infraproviders")
opFind.WithSummary("Get infraProviderConfig")
opFind.WithMapOfAnything(map[string]interface{}{"operationId": "getInfraProvider"})
opFind.WithMapOfAnything(map[string]any{"operationId": "getInfraProvider"})
_ = reflector.SetRequest(&opFind, new(getInfraProviderRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opFind, new(types.InfraProviderConfig), http.StatusOK)
_ = reflector.SetJSONResponse(&opFind, new(usererror.Error), http.StatusBadRequest)
@ -48,7 +48,7 @@ func infraProviderOperations(reflector *openapi3.Reflector) {
opCreate := openapi3.Operation{}
opCreate.WithTags("infraproviders")
opCreate.WithSummary("Create infraProvider config")
opCreate.WithMapOfAnything(map[string]interface{}{"operationId": "createInfraProvider"})
opCreate.WithMapOfAnything(map[string]any{"operationId": "createInfraProvider"})
_ = reflector.SetRequest(&opCreate, new(createInfraProviderConfigRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreate, new(types.InfraProviderConfig), http.StatusCreated)
_ = reflector.SetJSONResponse(&opCreate, new(usererror.Error), http.StatusBadRequest)

View File

@ -147,7 +147,7 @@ var queryParameterBranch = openapi3.ParameterOrRef{
func pipelineOperations(reflector *openapi3.Reflector) {
opCreate := openapi3.Operation{}
opCreate.WithTags("pipeline")
opCreate.WithMapOfAnything(map[string]interface{}{"operationId": "createPipeline"})
opCreate.WithMapOfAnything(map[string]any{"operationId": "createPipeline"})
_ = reflector.SetRequest(&opCreate, new(createPipelineRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreate, new(types.Pipeline), http.StatusCreated)
_ = reflector.SetJSONResponse(&opCreate, new(usererror.Error), http.StatusBadRequest)
@ -158,7 +158,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
opPipelines := openapi3.Operation{}
opPipelines.WithTags("pipeline")
opPipelines.WithMapOfAnything(map[string]interface{}{"operationId": "listPipelines"})
opPipelines.WithMapOfAnything(map[string]any{"operationId": "listPipelines"})
opPipelines.WithParameters(queryParameterQueryPipeline, QueryParameterPage,
QueryParameterLimit, queryParameterLatest, queryParameterLastExecutions)
_ = reflector.SetRequest(&opPipelines, new(repoRequest), http.MethodGet)
@ -171,7 +171,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
opFind := openapi3.Operation{}
opFind.WithTags("pipeline")
opFind.WithMapOfAnything(map[string]interface{}{"operationId": "findPipeline"})
opFind.WithMapOfAnything(map[string]any{"operationId": "findPipeline"})
_ = reflector.SetRequest(&opFind, new(getPipelineRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opFind, new(types.Pipeline), http.StatusOK)
_ = reflector.SetJSONResponse(&opFind, new(usererror.Error), http.StatusInternalServerError)
@ -182,7 +182,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
opDelete := openapi3.Operation{}
opDelete.WithTags("pipeline")
opDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deletePipeline"})
opDelete.WithMapOfAnything(map[string]any{"operationId": "deletePipeline"})
_ = reflector.SetRequest(&opDelete, new(getPipelineRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&opDelete, new(usererror.Error), http.StatusInternalServerError)
@ -193,7 +193,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
opUpdate := openapi3.Operation{}
opUpdate.WithTags("pipeline")
opUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "updatePipeline"})
opUpdate.WithMapOfAnything(map[string]any{"operationId": "updatePipeline"})
_ = reflector.SetRequest(&opUpdate, new(updatePipelineRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&opUpdate, new(types.Pipeline), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdate, new(usererror.Error), http.StatusBadRequest)
@ -207,7 +207,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
executionCreate := openapi3.Operation{}
executionCreate.WithTags("pipeline")
executionCreate.WithParameters(queryParameterBranch)
executionCreate.WithMapOfAnything(map[string]interface{}{"operationId": "createExecution"})
executionCreate.WithMapOfAnything(map[string]any{"operationId": "createExecution"})
_ = reflector.SetRequest(&executionCreate, new(createExecutionRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&executionCreate, new(types.Execution), http.StatusCreated)
_ = reflector.SetJSONResponse(&executionCreate, new(usererror.Error), http.StatusBadRequest)
@ -219,7 +219,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
executionFind := openapi3.Operation{}
executionFind.WithTags("pipeline")
executionFind.WithMapOfAnything(map[string]interface{}{"operationId": "findExecution"})
executionFind.WithMapOfAnything(map[string]any{"operationId": "findExecution"})
_ = reflector.SetRequest(&executionFind, new(getExecutionRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&executionFind, new(types.Execution), http.StatusOK)
_ = reflector.SetJSONResponse(&executionFind, new(usererror.Error), http.StatusInternalServerError)
@ -231,7 +231,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
executionCancel := openapi3.Operation{}
executionCancel.WithTags("pipeline")
executionCancel.WithMapOfAnything(map[string]interface{}{"operationId": "cancelExecution"})
executionCancel.WithMapOfAnything(map[string]any{"operationId": "cancelExecution"})
_ = reflector.SetRequest(&executionCancel, new(getExecutionRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&executionCancel, new(types.Execution), http.StatusOK)
_ = reflector.SetJSONResponse(&executionCancel, new(usererror.Error), http.StatusInternalServerError)
@ -243,7 +243,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
executionDelete := openapi3.Operation{}
executionDelete.WithTags("pipeline")
executionDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deleteExecution"})
executionDelete.WithMapOfAnything(map[string]any{"operationId": "deleteExecution"})
_ = reflector.SetRequest(&executionDelete, new(getExecutionRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&executionDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&executionDelete, new(usererror.Error), http.StatusInternalServerError)
@ -255,7 +255,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
executionList := openapi3.Operation{}
executionList.WithTags("pipeline")
executionList.WithMapOfAnything(map[string]interface{}{"operationId": "listExecutions"})
executionList.WithMapOfAnything(map[string]any{"operationId": "listExecutions"})
executionList.WithParameters(QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&executionList, new(pipelineRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&executionList, []types.Execution{}, http.StatusOK)
@ -268,7 +268,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
triggerCreate := openapi3.Operation{}
triggerCreate.WithTags("pipeline")
triggerCreate.WithMapOfAnything(map[string]interface{}{"operationId": "createTrigger"})
triggerCreate.WithMapOfAnything(map[string]any{"operationId": "createTrigger"})
_ = reflector.SetRequest(&triggerCreate, new(createTriggerRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&triggerCreate, new(types.Trigger), http.StatusCreated)
_ = reflector.SetJSONResponse(&triggerCreate, new(usererror.Error), http.StatusBadRequest)
@ -280,7 +280,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
triggerFind := openapi3.Operation{}
triggerFind.WithTags("pipeline")
triggerFind.WithMapOfAnything(map[string]interface{}{"operationId": "findTrigger"})
triggerFind.WithMapOfAnything(map[string]any{"operationId": "findTrigger"})
_ = reflector.SetRequest(&triggerFind, new(getTriggerRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&triggerFind, new(types.Trigger), http.StatusOK)
_ = reflector.SetJSONResponse(&triggerFind, new(usererror.Error), http.StatusInternalServerError)
@ -292,7 +292,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
triggerDelete := openapi3.Operation{}
triggerDelete.WithTags("pipeline")
triggerDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deleteTrigger"})
triggerDelete.WithMapOfAnything(map[string]any{"operationId": "deleteTrigger"})
_ = reflector.SetRequest(&triggerDelete, new(getTriggerRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&triggerDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&triggerDelete, new(usererror.Error), http.StatusInternalServerError)
@ -304,7 +304,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
triggerUpdate := openapi3.Operation{}
triggerUpdate.WithTags("pipeline")
triggerUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "updateTrigger"})
triggerUpdate.WithMapOfAnything(map[string]any{"operationId": "updateTrigger"})
_ = reflector.SetRequest(&triggerUpdate, new(updateTriggerRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&triggerUpdate, new(types.Trigger), http.StatusOK)
_ = reflector.SetJSONResponse(&triggerUpdate, new(usererror.Error), http.StatusBadRequest)
@ -317,7 +317,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
triggerList := openapi3.Operation{}
triggerList.WithTags("pipeline")
triggerList.WithMapOfAnything(map[string]interface{}{"operationId": "listTriggers"})
triggerList.WithMapOfAnything(map[string]any{"operationId": "listTriggers"})
triggerList.WithParameters(queryParameterQueryRepo, QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&triggerList, new(pipelineRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&triggerList, []types.Trigger{}, http.StatusOK)
@ -330,7 +330,7 @@ func pipelineOperations(reflector *openapi3.Reflector) {
logView := openapi3.Operation{}
logView.WithTags("pipeline")
logView.WithMapOfAnything(map[string]interface{}{"operationId": "viewLogs"})
logView.WithMapOfAnything(map[string]any{"operationId": "viewLogs"})
_ = reflector.SetRequest(&logView, new(logRequest), http.MethodGet)
_ = reflector.SetStringResponse(&logView, http.StatusOK, "application/json")
_ = reflector.SetJSONResponse(&logView, []*livelog.Line{}, http.StatusOK)

View File

@ -45,7 +45,7 @@ type getPluginsRequest struct {
func pluginOperations(reflector *openapi3.Reflector) {
opPlugins := openapi3.Operation{}
opPlugins.WithTags("plugins")
opPlugins.WithMapOfAnything(map[string]interface{}{"operationId": "listPlugins"})
opPlugins.WithMapOfAnything(map[string]any{"operationId": "listPlugins"})
opPlugins.WithParameters(QueryParameterPage, QueryParameterLimit, queryParameterQueryPlugin)
_ = reflector.SetRequest(&opPlugins, new(getPluginsRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opPlugins, []types.Plugin{}, http.StatusOK)

View File

@ -69,7 +69,7 @@ var QueryParameterPrincipalTypes = openapi3.ParameterOrRef{
func buildPrincipals(reflector *openapi3.Reflector) {
opList := openapi3.Operation{}
opList.WithTags("principals")
opList.WithMapOfAnything(map[string]interface{}{"operationId": "listPrincipals"})
opList.WithMapOfAnything(map[string]any{"operationId": "listPrincipals"})
opList.WithParameters(QueryParameterQueryPrincipals, QueryParameterPage,
QueryParameterLimit, QueryParameterPrincipalTypes)
_ = reflector.SetRequest(&opList, nil, http.MethodGet)
@ -81,7 +81,7 @@ func buildPrincipals(reflector *openapi3.Reflector) {
getPrincipal := openapi3.Operation{}
getPrincipal.WithTags("principals")
getPrincipal.WithMapOfAnything(map[string]interface{}{"operationId": "getPrincipal"})
getPrincipal.WithMapOfAnything(map[string]any{"operationId": "getPrincipal"})
_ = reflector.SetRequest(&getPrincipal, new(principalInfoRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&getPrincipal, new(types.PrincipalInfo), http.StatusOK)
_ = reflector.SetJSONResponse(&getPrincipal, new(usererror.Error), http.StatusBadRequest)

View File

@ -494,7 +494,7 @@ var queryParameterMentionedID = openapi3.ParameterOrRef{
func pullReqOperations(reflector *openapi3.Reflector) {
createPullReq := openapi3.Operation{}
createPullReq.WithTags("pullreq")
createPullReq.WithMapOfAnything(map[string]interface{}{"operationId": "createPullReq"})
createPullReq.WithMapOfAnything(map[string]any{"operationId": "createPullReq"})
_ = reflector.SetRequest(&createPullReq, new(createPullReqRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&createPullReq, new(types.PullReq), http.StatusCreated)
_ = reflector.SetJSONResponse(&createPullReq, new(usererror.Error), http.StatusBadRequest)
@ -505,7 +505,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
listPullReq := openapi3.Operation{}
listPullReq.WithTags("pullreq")
listPullReq.WithMapOfAnything(map[string]interface{}{"operationId": "listPullReq"})
listPullReq.WithMapOfAnything(map[string]any{"operationId": "listPullReq"})
listPullReq.WithParameters(
queryParameterStatePullRequest, queryParameterSourceRepoRefPullRequest,
queryParameterSourceBranchPullRequest, queryParameterTargetBranchPullRequest,
@ -528,7 +528,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
getPullReq := openapi3.Operation{}
getPullReq.WithTags("pullreq")
getPullReq.WithMapOfAnything(map[string]interface{}{"operationId": "getPullReq"})
getPullReq.WithMapOfAnything(map[string]any{"operationId": "getPullReq"})
getPullReq.WithParameters(queryParameterIncludeChecks, queryParameterIncludeRules)
_ = reflector.SetRequest(&getPullReq, new(getPullReqRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&getPullReq, new(types.PullReq), http.StatusOK)
@ -540,7 +540,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
getPullReqByBranches := openapi3.Operation{}
getPullReqByBranches.WithTags("pullreq")
getPullReqByBranches.WithMapOfAnything(map[string]interface{}{"operationId": "getPullReqByBranches"})
getPullReqByBranches.WithMapOfAnything(map[string]any{"operationId": "getPullReqByBranches"})
getPullReqByBranches.WithParameters(queryParameterSourceRepoRefPullRequest,
queryParameterIncludeChecks, queryParameterIncludeRules)
_ = reflector.SetRequest(&getPullReqByBranches, new(getPullReqByBranchesRequest), http.MethodGet)
@ -555,7 +555,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
putPullReq := openapi3.Operation{}
putPullReq.WithTags("pullreq")
putPullReq.WithMapOfAnything(map[string]interface{}{"operationId": "updatePullReq"})
putPullReq.WithMapOfAnything(map[string]any{"operationId": "updatePullReq"})
_ = reflector.SetRequest(&putPullReq, new(updatePullReqRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&putPullReq, new(types.PullReq), http.StatusOK)
_ = reflector.SetJSONResponse(&putPullReq, new(usererror.Error), http.StatusBadRequest)
@ -566,7 +566,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
statePullReq := openapi3.Operation{}
statePullReq.WithTags("pullreq")
statePullReq.WithMapOfAnything(map[string]interface{}{"operationId": "statePullReq"})
statePullReq.WithMapOfAnything(map[string]any{"operationId": "statePullReq"})
_ = reflector.SetRequest(&statePullReq, new(statePullReqRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&statePullReq, new(types.PullReq), http.StatusOK)
_ = reflector.SetJSONResponse(&statePullReq, new(usererror.Error), http.StatusBadRequest)
@ -577,7 +577,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
listPullReqActivities := openapi3.Operation{}
listPullReqActivities.WithTags("pullreq")
listPullReqActivities.WithMapOfAnything(map[string]interface{}{"operationId": "listPullReqActivities"})
listPullReqActivities.WithMapOfAnything(map[string]any{"operationId": "listPullReqActivities"})
listPullReqActivities.WithParameters(
queryParameterKindPullRequestActivity, queryParameterTypePullRequestActivity,
queryParameterAfter, queryParameterBeforePullRequestActivity, QueryParameterLimit)
@ -592,7 +592,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
commentCreatePullReq := openapi3.Operation{}
commentCreatePullReq.WithTags("pullreq")
commentCreatePullReq.WithMapOfAnything(map[string]interface{}{"operationId": "commentCreatePullReq"})
commentCreatePullReq.WithMapOfAnything(map[string]any{"operationId": "commentCreatePullReq"})
_ = reflector.SetRequest(&commentCreatePullReq, new(commentCreatePullReqRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&commentCreatePullReq, new(types.PullReqActivity), http.StatusOK)
_ = reflector.SetJSONResponse(&commentCreatePullReq, new(usererror.Error), http.StatusBadRequest)
@ -604,7 +604,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
commentUpdatePullReq := openapi3.Operation{}
commentUpdatePullReq.WithTags("pullreq")
commentUpdatePullReq.WithMapOfAnything(map[string]interface{}{"operationId": "commentUpdatePullReq"})
commentUpdatePullReq.WithMapOfAnything(map[string]any{"operationId": "commentUpdatePullReq"})
_ = reflector.SetRequest(&commentUpdatePullReq, new(commentUpdatePullReqRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&commentUpdatePullReq, new(types.PullReqActivity), http.StatusOK)
_ = reflector.SetJSONResponse(&commentUpdatePullReq, new(usererror.Error), http.StatusBadRequest)
@ -616,7 +616,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
commentDeletePullReq := openapi3.Operation{}
commentDeletePullReq.WithTags("pullreq")
commentDeletePullReq.WithMapOfAnything(map[string]interface{}{"operationId": "commentDeletePullReq"})
commentDeletePullReq.WithMapOfAnything(map[string]any{"operationId": "commentDeletePullReq"})
_ = reflector.SetRequest(&commentDeletePullReq, new(commentDeletePullReqRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&commentDeletePullReq, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&commentDeletePullReq, new(usererror.Error), http.StatusBadRequest)
@ -628,7 +628,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
commentStatusPullReq := openapi3.Operation{}
commentStatusPullReq.WithTags("pullreq")
commentStatusPullReq.WithMapOfAnything(map[string]interface{}{"operationId": "commentStatusPullReq"})
commentStatusPullReq.WithMapOfAnything(map[string]any{"operationId": "commentStatusPullReq"})
_ = reflector.SetRequest(&commentStatusPullReq, new(commentStatusPullReqRequest), http.MethodPut)
_ = reflector.SetJSONResponse(&commentStatusPullReq, new(types.PullReqActivity), http.StatusOK)
_ = reflector.SetJSONResponse(&commentStatusPullReq, new(usererror.Error), http.StatusBadRequest)
@ -640,7 +640,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
commentApplySuggestions := openapi3.Operation{}
commentApplySuggestions.WithTags("pullreq")
commentApplySuggestions.WithMapOfAnything(map[string]interface{}{"operationId": "commentApplySuggestions"})
commentApplySuggestions.WithMapOfAnything(map[string]any{"operationId": "commentApplySuggestions"})
_ = reflector.SetRequest(&commentApplySuggestions, new(commentApplySuggestionstRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&commentApplySuggestions, new(pullreq.CommentApplySuggestionsOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&commentApplySuggestions, new(usererror.Error), http.StatusBadRequest)
@ -653,7 +653,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
reviewerAdd := openapi3.Operation{}
reviewerAdd.WithTags("pullreq")
reviewerAdd.WithMapOfAnything(map[string]interface{}{"operationId": "reviewerAddPullReq"})
reviewerAdd.WithMapOfAnything(map[string]any{"operationId": "reviewerAddPullReq"})
_ = reflector.SetRequest(&reviewerAdd, new(reviewerAddPullReqRequest), http.MethodPut)
_ = reflector.SetJSONResponse(&reviewerAdd, new(types.PullReqReviewer), http.StatusOK)
_ = reflector.SetJSONResponse(&reviewerAdd, new(usererror.Error), http.StatusBadRequest)
@ -665,7 +665,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
reviewerList := openapi3.Operation{}
reviewerList.WithTags("pullreq")
reviewerList.WithMapOfAnything(map[string]interface{}{"operationId": "reviewerListPullReq"})
reviewerList.WithMapOfAnything(map[string]any{"operationId": "reviewerListPullReq"})
_ = reflector.SetRequest(&reviewerList, new(reviewerListPullReqRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&reviewerList, new([]*types.PullReqReviewer), http.StatusOK)
_ = reflector.SetJSONResponse(&reviewerList, new(usererror.Error), http.StatusBadRequest)
@ -677,7 +677,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
reviewerDelete := openapi3.Operation{}
reviewerDelete.WithTags("pullreq")
reviewerDelete.WithMapOfAnything(map[string]interface{}{"operationId": "reviewerDeletePullReq"})
reviewerDelete.WithMapOfAnything(map[string]any{"operationId": "reviewerDeletePullReq"})
_ = reflector.SetRequest(&reviewerDelete, new(reviewerDeletePullReqRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&reviewerDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&reviewerDelete, new(usererror.Error), http.StatusBadRequest)
@ -689,7 +689,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
reviewSubmit := openapi3.Operation{}
reviewSubmit.WithTags("pullreq")
reviewSubmit.WithMapOfAnything(map[string]interface{}{"operationId": "reviewSubmitPullReq"})
reviewSubmit.WithMapOfAnything(map[string]any{"operationId": "reviewSubmitPullReq"})
_ = reflector.SetRequest(&reviewSubmit, new(reviewSubmitPullReqRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&reviewSubmit, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&reviewSubmit, new(usererror.Error), http.StatusBadRequest)
@ -701,7 +701,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
userGroupReviewerAdd := openapi3.Operation{}
userGroupReviewerAdd.WithTags("pullreq")
userGroupReviewerAdd.WithMapOfAnything(map[string]interface{}{"operationId": "userGroupReviewerAddPullReq"})
userGroupReviewerAdd.WithMapOfAnything(map[string]any{"operationId": "userGroupReviewerAddPullReq"})
_ = reflector.SetRequest(&userGroupReviewerAdd, new(userGroupReviewerAddRequest), http.MethodPut)
_ = reflector.SetJSONResponse(&userGroupReviewerAdd, new(types.UserGroupReviewer), http.StatusOK)
_ = reflector.SetJSONResponse(&userGroupReviewerAdd, new(usererror.Error), http.StatusBadRequest)
@ -713,7 +713,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
userGroupReviewerDelete := openapi3.Operation{}
userGroupReviewerDelete.WithTags("pullreq")
userGroupReviewerDelete.WithMapOfAnything(map[string]interface{}{"operationId": "userGroupReviewerDeletePullReq"})
userGroupReviewerDelete.WithMapOfAnything(map[string]any{"operationId": "userGroupReviewerDeletePullReq"})
_ = reflector.SetRequest(&userGroupReviewerDelete, new(userGroupReviewerDeleteRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&userGroupReviewerDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&userGroupReviewerDelete, new(usererror.Error), http.StatusBadRequest)
@ -725,7 +725,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
combinedReviewerList := openapi3.Operation{}
combinedReviewerList.WithTags("pullreq")
combinedReviewerList.WithMapOfAnything(map[string]interface{}{"operationId": "reviewerCombinedListPullReq"})
combinedReviewerList.WithMapOfAnything(map[string]any{"operationId": "reviewerCombinedListPullReq"})
_ = reflector.SetRequest(&combinedReviewerList, new(pullReqRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&combinedReviewerList, new(pullreq.CombinedListResponse), http.StatusOK)
_ = reflector.SetJSONResponse(&combinedReviewerList, new(usererror.Error), http.StatusBadRequest)
@ -737,7 +737,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
mergePullReqOp := openapi3.Operation{}
mergePullReqOp.WithTags("pullreq")
mergePullReqOp.WithMapOfAnything(map[string]interface{}{"operationId": "mergePullReqOp"})
mergePullReqOp.WithMapOfAnything(map[string]any{"operationId": "mergePullReqOp"})
_ = reflector.SetRequest(&mergePullReqOp, new(mergePullReq), http.MethodPost)
_ = reflector.SetJSONResponse(&mergePullReqOp, new(types.MergeResponse), http.StatusOK)
_ = reflector.SetJSONResponse(&mergePullReqOp, new(usererror.Error), http.StatusBadRequest)
@ -752,7 +752,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
revertPullReqOp := openapi3.Operation{}
revertPullReqOp.WithTags("pullreq")
revertPullReqOp.WithMapOfAnything(map[string]interface{}{"operationId": "revertPullReqOp"})
revertPullReqOp.WithMapOfAnything(map[string]any{"operationId": "revertPullReqOp"})
_ = reflector.SetRequest(&revertPullReqOp, &struct {
pullReqRequest
pullreq.RevertInput
@ -768,7 +768,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opListCommits := openapi3.Operation{}
opListCommits.WithTags("pullreq")
opListCommits.WithMapOfAnything(map[string]interface{}{"operationId": "listPullReqCommits"})
opListCommits.WithMapOfAnything(map[string]any{"operationId": "listPullReqCommits"})
opListCommits.WithParameters(QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&opListCommits, new(pullReqRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opListCommits, []types.Commit{}, http.StatusOK)
@ -780,7 +780,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opMetaData := openapi3.Operation{}
opMetaData.WithTags("pullreq")
opMetaData.WithMapOfAnything(map[string]interface{}{"operationId": "pullReqMetaData"})
opMetaData.WithMapOfAnything(map[string]any{"operationId": "pullReqMetaData"})
_ = reflector.SetRequest(&opMetaData, new(pullReqRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opMetaData, new(types.PullReqStats), http.StatusOK)
_ = reflector.SetJSONResponse(&opMetaData, new(usererror.Error), http.StatusInternalServerError)
@ -791,7 +791,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opRestoreBranch := openapi3.Operation{}
opRestoreBranch.WithTags("pullreq")
opRestoreBranch.WithMapOfAnything(map[string]interface{}{"operationId": "restorePullReqSourceBranch"})
opRestoreBranch.WithMapOfAnything(map[string]any{"operationId": "restorePullReqSourceBranch"})
_ = reflector.SetRequest(&opRestoreBranch, struct {
pullReqRequest
pullreq.RestoreBranchInput
@ -808,7 +808,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opDeleteBranch := openapi3.Operation{}
opDeleteBranch.WithTags("pullreq")
opDeleteBranch.WithMapOfAnything(map[string]interface{}{"operationId": "deletePullReqSourceBranch"})
opDeleteBranch.WithMapOfAnything(map[string]any{"operationId": "deletePullReqSourceBranch"})
opDeleteBranch.WithParameters(queryParameterBypassRules, queryParameterDryRunRules)
_ = reflector.SetRequest(&opDeleteBranch, new(pullReqRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDeleteBranch, new(types.DeleteBranchOutput), http.StatusOK)
@ -822,7 +822,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opChangeTargetBranch := openapi3.Operation{}
opChangeTargetBranch.WithTags("pullreq")
opChangeTargetBranch.WithMapOfAnything(map[string]interface{}{"operationId": "changeTargetBranch"})
opChangeTargetBranch.WithMapOfAnything(map[string]any{"operationId": "changeTargetBranch"})
_ = reflector.SetRequest(&opChangeTargetBranch, struct {
pullReqRequest
pullreq.ChangeTargetBranchInput
@ -837,7 +837,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
fileViewAdd := openapi3.Operation{}
fileViewAdd.WithTags("pullreq")
fileViewAdd.WithMapOfAnything(map[string]interface{}{"operationId": "fileViewAddPullReq"})
fileViewAdd.WithMapOfAnything(map[string]any{"operationId": "fileViewAddPullReq"})
_ = reflector.SetRequest(&fileViewAdd, new(fileViewAddPullReqRequest), http.MethodPut)
_ = reflector.SetJSONResponse(&fileViewAdd, new(types.PullReqFileView), http.StatusOK)
_ = reflector.SetJSONResponse(&fileViewAdd, new(usererror.Error), http.StatusBadRequest)
@ -849,7 +849,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
fileViewList := openapi3.Operation{}
fileViewList.WithTags("pullreq")
fileViewList.WithMapOfAnything(map[string]interface{}{"operationId": "fileViewListPullReq"})
fileViewList.WithMapOfAnything(map[string]any{"operationId": "fileViewListPullReq"})
_ = reflector.SetRequest(&fileViewList, new(fileViewListPullReqRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&fileViewList, []types.PullReqFileView{}, http.StatusOK)
_ = reflector.SetJSONResponse(&fileViewList, new(usererror.Error), http.StatusBadRequest)
@ -861,7 +861,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
fileViewDelete := openapi3.Operation{}
fileViewDelete.WithTags("pullreq")
fileViewDelete.WithMapOfAnything(map[string]interface{}{"operationId": "fileViewDeletePullReq"})
fileViewDelete.WithMapOfAnything(map[string]any{"operationId": "fileViewDeletePullReq"})
_ = reflector.SetRequest(&fileViewDelete, new(fileViewDeletePullReqRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&fileViewDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&fileViewDelete, new(usererror.Error), http.StatusBadRequest)
@ -873,7 +873,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
codeOwners := openapi3.Operation{}
codeOwners.WithTags("pullreq")
codeOwners.WithMapOfAnything(map[string]interface{}{"operationId": "codeownersPullReq"})
codeOwners.WithMapOfAnything(map[string]any{"operationId": "codeownersPullReq"})
_ = reflector.SetRequest(&codeOwners, new(pullReqRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&codeOwners, types.CodeOwnerEvaluation{}, http.StatusOK)
_ = reflector.SetJSONResponse(&codeOwners, new(usererror.Error), http.StatusUnprocessableEntity)
@ -887,7 +887,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opDiff := openapi3.Operation{}
opDiff.WithTags("pullreq")
opDiff.WithMapOfAnything(map[string]interface{}{"operationId": "diffPullReq"})
opDiff.WithMapOfAnything(map[string]any{"operationId": "diffPullReq"})
panicOnErr(reflector.SetRequest(&opDiff, new(getRawPRDiffRequest), http.MethodGet))
panicOnErr(reflector.SetStringResponse(&opDiff, http.StatusOK, "text/plain"))
panicOnErr(reflector.SetJSONResponse(&opDiff, new([]git.FileDiff), http.StatusOK))
@ -899,7 +899,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opPostDiff := openapi3.Operation{}
opPostDiff.WithTags("pullreq")
opPostDiff.WithMapOfAnything(map[string]interface{}{"operationId": "diffPullReqPost"})
opPostDiff.WithMapOfAnything(map[string]any{"operationId": "diffPullReqPost"})
panicOnErr(reflector.SetRequest(&opPostDiff, new(postRawPRDiffRequest), http.MethodPost))
panicOnErr(reflector.SetStringResponse(&opPostDiff, http.StatusOK, "text/plain"))
panicOnErr(reflector.SetJSONResponse(&opPostDiff, new([]git.FileDiff), http.StatusOK))
@ -911,7 +911,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opChecks := openapi3.Operation{}
opChecks.WithTags("pullreq")
opChecks.WithMapOfAnything(map[string]interface{}{"operationId": "checksPullReq"})
opChecks.WithMapOfAnything(map[string]any{"operationId": "checksPullReq"})
_ = reflector.SetRequest(&opChecks, new(getPullReqChecksRequest), http.MethodGet)
panicOnErr(reflector.SetJSONResponse(&opChecks, new(types.PullReqChecks), http.StatusOK))
panicOnErr(reflector.SetJSONResponse(&opChecks, new(usererror.Error), http.StatusInternalServerError))
@ -922,7 +922,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opAssignLabel := openapi3.Operation{}
opAssignLabel.WithTags("pullreq")
opAssignLabel.WithMapOfAnything(map[string]interface{}{"operationId": "assignLabel"})
opAssignLabel.WithMapOfAnything(map[string]any{"operationId": "assignLabel"})
_ = reflector.SetRequest(&opAssignLabel, new(pullReqAssignLabelInput), http.MethodPut)
_ = reflector.SetJSONResponse(&opAssignLabel, new(types.PullReqLabel), http.StatusOK)
_ = reflector.SetJSONResponse(&opAssignLabel, new(usererror.Error), http.StatusBadRequest)
@ -934,7 +934,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opListLabels := openapi3.Operation{}
opListLabels.WithTags("pullreq")
opListLabels.WithMapOfAnything(map[string]interface{}{"operationId": "listLabels"})
opListLabels.WithMapOfAnything(map[string]any{"operationId": "listLabels"})
opListLabels.WithParameters(
QueryParameterPage, QueryParameterLimit, QueryParameterAssignable, QueryParameterQueryLabel)
_ = reflector.SetRequest(&opListLabels, new(pullReqRequest), http.MethodGet)
@ -948,7 +948,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opUnassignLabel := openapi3.Operation{}
opUnassignLabel.WithTags("pullreq")
opUnassignLabel.WithMapOfAnything(map[string]interface{}{"operationId": "unassignLabel"})
opUnassignLabel.WithMapOfAnything(map[string]any{"operationId": "unassignLabel"})
_ = reflector.SetRequest(&opUnassignLabel, struct {
pullReqRequest
LabelID int64 `path:"label_id"`
@ -963,7 +963,7 @@ func pullReqOperations(reflector *openapi3.Reflector) {
opPRCandidates := openapi3.Operation{}
opPRCandidates.WithTags("pullreq")
opPRCandidates.WithMapOfAnything(map[string]interface{}{"operationId": "prCandidates"})
opPRCandidates.WithMapOfAnything(map[string]any{"operationId": "prCandidates"})
opPRCandidates.WithParameters(QueryParameterLimit)
_ = reflector.SetRequest(&opPRCandidates, new(repoRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opPRCandidates, new([]types.BranchTable), http.StatusOK)

View File

@ -83,8 +83,8 @@ type commitFilesRequest struct {
// contentType is a plugin for repo.ContentType to allow using oneof.
type contentType string
func (contentType) Enum() []interface{} {
return []interface{}{repo.ContentTypeFile, repo.ContentTypeDir, repo.ContentTypeSymlink, repo.ContentTypeSubmodule}
func (contentType) Enum() []any {
return []any{repo.ContentTypeFile, repo.ContentTypeDir, repo.ContentTypeSymlink, repo.ContentTypeSubmodule}
}
// contentInfo is used to overshadow the contentype of repo.ContentInfo.
@ -102,8 +102,8 @@ type dirContent struct {
// content is a plugin for repo.content to allow using oneof.
type content struct{}
func (content) JSONSchemaOneOf() []interface{} {
return []interface{}{repo.FileContent{}, dirContent{}, repo.SymlinkContent{}, repo.SubmoduleContent{}}
func (content) JSONSchemaOneOf() []any {
return []any{repo.FileContent{}, dirContent{}, repo.SymlinkContent{}, repo.SubmoduleContent{}}
}
// getContentOutput is used to overshadow the content and contenttype of repo.GetContentOutput.
@ -478,7 +478,7 @@ var queryParameterSortBranch = openapi3.ParameterOrRef{
Schema: &openapi3.Schema{
Type: ptrSchemaType(openapi3.SchemaTypeString),
Default: ptrptr(enum.BranchSortOptionName.String()),
Enum: []interface{}{
Enum: []any{
ptr.String(enum.BranchSortOptionName.String()),
ptr.String(enum.BranchSortOptionDate.String()),
},
@ -511,7 +511,7 @@ var queryParameterSortTags = openapi3.ParameterOrRef{
Schema: &openapi3.Schema{
Type: ptrSchemaType(openapi3.SchemaTypeString),
Default: ptrptr(enum.TagSortOptionName.String()),
Enum: []interface{}{
Enum: []any{
ptr.String(enum.TagSortOptionName.String()),
ptr.String(enum.TagSortOptionDate.String()),
},
@ -789,7 +789,7 @@ var queryParameterIncludeValues = openapi3.ParameterOrRef{
func repoOperations(reflector *openapi3.Reflector) {
createRepository := openapi3.Operation{}
createRepository.WithTags("repository")
createRepository.WithMapOfAnything(map[string]interface{}{"operationId": "createRepository"})
createRepository.WithMapOfAnything(map[string]any{"operationId": "createRepository"})
createRepository.WithParameters(queryParameterSpacePath)
_ = reflector.SetRequest(&createRepository, new(createRepositoryRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&createRepository, new(repo.RepositoryOutput), http.StatusCreated)
@ -801,7 +801,7 @@ func repoOperations(reflector *openapi3.Reflector) {
importRepository := openapi3.Operation{}
importRepository.WithTags("repository")
importRepository.WithMapOfAnything(map[string]interface{}{"operationId": "importRepository"})
importRepository.WithMapOfAnything(map[string]any{"operationId": "importRepository"})
importRepository.WithParameters(queryParameterSpacePath)
_ = reflector.SetRequest(&importRepository, &struct{ repo.ImportInput }{}, http.MethodPost)
_ = reflector.SetJSONResponse(&importRepository, new(repo.RepositoryOutput), http.StatusCreated)
@ -813,7 +813,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opFind := openapi3.Operation{}
opFind.WithTags("repository")
opFind.WithMapOfAnything(map[string]interface{}{"operationId": "findRepository"})
opFind.WithMapOfAnything(map[string]any{"operationId": "findRepository"})
_ = reflector.SetRequest(&opFind, new(repoRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opFind, new(repo.RepositoryOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opFind, new(usererror.Error), http.StatusInternalServerError)
@ -824,7 +824,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opUpdate := openapi3.Operation{}
opUpdate.WithTags("repository")
opUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "updateRepository"})
opUpdate.WithMapOfAnything(map[string]any{"operationId": "updateRepository"})
_ = reflector.SetRequest(&opUpdate, new(updateRepoRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&opUpdate, new(repo.RepositoryOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdate, new(usererror.Error), http.StatusBadRequest)
@ -836,7 +836,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opUpdateDefaultBranch := openapi3.Operation{}
opUpdateDefaultBranch.WithTags("repository")
opUpdateDefaultBranch.WithMapOfAnything(map[string]interface{}{"operationId": "updateDefaultBranch"})
opUpdateDefaultBranch.WithMapOfAnything(map[string]any{"operationId": "updateDefaultBranch"})
_ = reflector.SetRequest(&opUpdateDefaultBranch, new(updateDefaultBranchRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opUpdateDefaultBranch, new(repo.RepositoryOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdateDefaultBranch, new(usererror.Error), http.StatusBadRequest)
@ -847,7 +847,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opDelete := openapi3.Operation{}
opDelete.WithTags("repository")
opDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deleteRepository"})
opDelete.WithMapOfAnything(map[string]any{"operationId": "deleteRepository"})
_ = reflector.SetRequest(&opDelete, new(repoRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDelete, new(repo.SoftDeleteResponse), http.StatusOK)
_ = reflector.SetJSONResponse(&opDelete, new(usererror.Error), http.StatusInternalServerError)
@ -858,7 +858,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opPurge := openapi3.Operation{}
opPurge.WithTags("repository")
opPurge.WithMapOfAnything(map[string]interface{}{"operationId": "purgeRepository"})
opPurge.WithMapOfAnything(map[string]any{"operationId": "purgeRepository"})
opPurge.WithParameters(queryParameterDeletedAt)
_ = reflector.SetRequest(&opPurge, new(repoRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opPurge, nil, http.StatusNoContent)
@ -870,7 +870,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opRestore := openapi3.Operation{}
opRestore.WithTags("repository")
opRestore.WithMapOfAnything(map[string]interface{}{"operationId": "restoreRepository"})
opRestore.WithMapOfAnything(map[string]any{"operationId": "restoreRepository"})
opRestore.WithParameters(queryParameterDeletedAt)
_ = reflector.SetRequest(&opRestore, new(restoreRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opRestore, new(repo.RepositoryOutput), http.StatusOK)
@ -883,7 +883,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opMove := openapi3.Operation{}
opMove.WithTags("repository")
opMove.WithMapOfAnything(map[string]interface{}{"operationId": "moveRepository"})
opMove.WithMapOfAnything(map[string]any{"operationId": "moveRepository"})
_ = reflector.SetRequest(&opMove, new(moveRepoRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opMove, new(repo.RepositoryOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opMove, new(usererror.Error), http.StatusBadRequest)
@ -895,7 +895,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opUpdatePublicAccess := openapi3.Operation{}
opUpdatePublicAccess.WithTags("repository")
opUpdatePublicAccess.WithMapOfAnything(
map[string]interface{}{"operationId": "updatePublicAccess"})
map[string]any{"operationId": "updatePublicAccess"})
_ = reflector.SetRequest(
&opUpdatePublicAccess, new(updateRepoPublicAccessRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opUpdatePublicAccess, new(repo.RepositoryOutput), http.StatusOK)
@ -909,7 +909,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opServiceAccounts := openapi3.Operation{}
opServiceAccounts.WithTags("repository")
opServiceAccounts.WithMapOfAnything(map[string]interface{}{"operationId": "listRepositoryServiceAccounts"})
opServiceAccounts.WithMapOfAnything(map[string]any{"operationId": "listRepositoryServiceAccounts"})
_ = reflector.SetRequest(&opServiceAccounts, new(repoRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opServiceAccounts, []types.ServiceAccount{}, http.StatusOK)
_ = reflector.SetJSONResponse(&opServiceAccounts, new(usererror.Error), http.StatusInternalServerError)
@ -920,7 +920,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opGetContent := openapi3.Operation{}
opGetContent.WithTags("repository")
opGetContent.WithMapOfAnything(map[string]interface{}{"operationId": "getContent"})
opGetContent.WithMapOfAnything(map[string]any{"operationId": "getContent"})
opGetContent.WithParameters(queryParameterGitRef, queryParameterIncludeCommit, queryParameterFlattenDirectories)
_ = reflector.SetRequest(&opGetContent, new(getContentRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opGetContent, new(getContentOutput), http.StatusOK)
@ -932,7 +932,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opListPaths := openapi3.Operation{}
opListPaths.WithTags("repository")
opListPaths.WithMapOfAnything(map[string]interface{}{"operationId": "listPaths"})
opListPaths.WithMapOfAnything(map[string]any{"operationId": "listPaths"})
opListPaths.WithParameters(queryParameterGitRef, queryParameterIncludeDirectories)
_ = reflector.SetRequest(&opListPaths, new(repoRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opListPaths, new(repo.ListPathsOutput), http.StatusOK)
@ -944,7 +944,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opPathDetails := openapi3.Operation{}
opPathDetails.WithTags("repository")
opPathDetails.WithMapOfAnything(map[string]interface{}{"operationId": "pathDetails"})
opPathDetails.WithMapOfAnything(map[string]any{"operationId": "pathDetails"})
opPathDetails.WithParameters(queryParameterGitRef)
_ = reflector.SetRequest(&opPathDetails, new(pathsDetailsRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opPathDetails, new(repo.PathsDetailsOutput), http.StatusOK)
@ -956,7 +956,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opGetRaw := openapi3.Operation{}
opGetRaw.WithTags("repository")
opGetRaw.WithMapOfAnything(map[string]interface{}{"operationId": "getRaw"})
opGetRaw.WithMapOfAnything(map[string]any{"operationId": "getRaw"})
opGetRaw.WithParameters(queryParameterGitRef)
_ = reflector.SetRequest(&opGetRaw, new(getContentRequest), http.MethodGet)
// TODO: Figure out how to provide proper list of all potential mime types
@ -969,7 +969,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opGetBlame := openapi3.Operation{}
opGetBlame.WithTags("repository")
opGetBlame.WithMapOfAnything(map[string]interface{}{"operationId": "getBlame"})
opGetBlame.WithMapOfAnything(map[string]any{"operationId": "getBlame"})
opGetBlame.WithParameters(queryParameterGitRef,
queryParameterLineFrom, queryParameterLineTo)
_ = reflector.SetRequest(&opGetBlame, new(getBlameRequest), http.MethodGet)
@ -982,7 +982,7 @@ func repoOperations(reflector *openapi3.Reflector) {
importProgressRepository := openapi3.Operation{}
importProgressRepository.WithTags("repository")
importProgressRepository.WithMapOfAnything(map[string]interface{}{"operationId": "importProgressRepository"})
importProgressRepository.WithMapOfAnything(map[string]any{"operationId": "importProgressRepository"})
_ = reflector.SetRequest(&importProgressRepository, new(repoRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&importProgressRepository, job.Progress{}, http.StatusOK)
_ = reflector.SetJSONResponse(&importProgressRepository, new(usererror.Error), http.StatusBadRequest)
@ -993,7 +993,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opListCommits := openapi3.Operation{}
opListCommits.WithTags("repository")
opListCommits.WithMapOfAnything(map[string]interface{}{"operationId": "listCommits"})
opListCommits.WithMapOfAnything(map[string]any{"operationId": "listCommits"})
opListCommits.WithParameters(queryParameterGitRef, queryParameterAfterCommits, queryParameterPath,
queryParameterSince, queryParameterUntil, queryParameterCommitter, queryParameterCommitterID,
queryParameterAuthor, queryParameterAuthoredByID, QueryParameterPage, QueryParameterLimit, QueryParamIncludeStats)
@ -1007,7 +1007,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opGetCommit := openapi3.Operation{}
opGetCommit.WithTags("repository")
opGetCommit.WithMapOfAnything(map[string]interface{}{"operationId": "getCommit"})
opGetCommit.WithMapOfAnything(map[string]any{"operationId": "getCommit"})
_ = reflector.SetRequest(&opGetCommit, new(GetCommitRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opGetCommit, types.Commit{}, http.StatusOK)
_ = reflector.SetJSONResponse(&opGetCommit, new(usererror.Error), http.StatusInternalServerError)
@ -1018,7 +1018,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opCalculateCommitDivergence := openapi3.Operation{}
opCalculateCommitDivergence.WithTags("repository")
opCalculateCommitDivergence.WithMapOfAnything(map[string]interface{}{"operationId": "calculateCommitDivergence"})
opCalculateCommitDivergence.WithMapOfAnything(map[string]any{"operationId": "calculateCommitDivergence"})
_ = reflector.SetRequest(&opCalculateCommitDivergence, new(calculateCommitDivergenceRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCalculateCommitDivergence, []types.CommitDivergence{}, http.StatusOK)
_ = reflector.SetJSONResponse(&opCalculateCommitDivergence, new(usererror.Error), http.StatusInternalServerError)
@ -1030,7 +1030,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opCreateBranch := openapi3.Operation{}
opCreateBranch.WithTags("repository")
opCreateBranch.WithMapOfAnything(map[string]interface{}{"operationId": "createBranch"})
opCreateBranch.WithMapOfAnything(map[string]any{"operationId": "createBranch"})
_ = reflector.SetRequest(&opCreateBranch, new(createBranchRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreateBranch, new(types.CreateBranchOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opCreateBranch, new(types.CreateBranchOutput), http.StatusCreated)
@ -1043,7 +1043,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opGetBranch := openapi3.Operation{}
opGetBranch.WithTags("repository")
opGetBranch.WithMapOfAnything(map[string]interface{}{"operationId": "getBranch"})
opGetBranch.WithMapOfAnything(map[string]any{"operationId": "getBranch"})
opGetBranch.WithParameters(
queryParameterIncludeChecks, queryParameterIncludeRules, queryParameterIncludePullReqs,
queryParameterMaxDivergence,
@ -1058,7 +1058,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opDeleteBranch := openapi3.Operation{}
opDeleteBranch.WithTags("repository")
opDeleteBranch.WithMapOfAnything(map[string]interface{}{"operationId": "deleteBranch"})
opDeleteBranch.WithMapOfAnything(map[string]any{"operationId": "deleteBranch"})
opDeleteBranch.WithParameters(queryParameterBypassRules, queryParameterDryRunRules)
_ = reflector.SetRequest(&opDeleteBranch, new(deleteBranchRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDeleteBranch, new(types.DeleteBranchOutput), http.StatusOK)
@ -1071,7 +1071,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opListBranches := openapi3.Operation{}
opListBranches.WithTags("repository")
opListBranches.WithMapOfAnything(map[string]interface{}{"operationId": "listBranches"})
opListBranches.WithMapOfAnything(map[string]any{"operationId": "listBranches"})
opListBranches.WithParameters(
queryParameterQueryBranches, queryParameterOrder, queryParameterSortBranch,
QueryParameterPage, QueryParameterLimit,
@ -1089,7 +1089,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opListTags := openapi3.Operation{}
opListTags.WithTags("repository")
opListTags.WithMapOfAnything(map[string]interface{}{"operationId": "listTags"})
opListTags.WithMapOfAnything(map[string]any{"operationId": "listTags"})
opListTags.WithParameters(queryParameterIncludeCommit,
queryParameterQueryTags, queryParameterOrder, queryParameterSortTags,
QueryParameterPage, QueryParameterLimit)
@ -1103,7 +1103,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opCreateTag := openapi3.Operation{}
opCreateTag.WithTags("repository")
opCreateTag.WithMapOfAnything(map[string]interface{}{"operationId": "createTag"})
opCreateTag.WithMapOfAnything(map[string]any{"operationId": "createTag"})
_ = reflector.SetRequest(&opCreateTag, new(createTagRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreateTag, new(types.CreateCommitTagOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opCreateTag, new(types.CreateCommitTagOutput), http.StatusCreated)
@ -1117,7 +1117,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opDeleteTag := openapi3.Operation{}
opDeleteTag.WithTags("repository")
opDeleteTag.WithMapOfAnything(map[string]interface{}{"operationId": "deleteTag"})
opDeleteTag.WithMapOfAnything(map[string]any{"operationId": "deleteTag"})
opDeleteTag.WithParameters(queryParameterBypassRules, queryParameterDryRunRules)
_ = reflector.SetRequest(&opDeleteTag, new(deleteTagRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDeleteTag, new(types.DeleteCommitTagOutput), http.StatusOK)
@ -1131,7 +1131,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opCommitFiles := openapi3.Operation{}
opCommitFiles.WithTags("repository")
opCommitFiles.WithMapOfAnything(map[string]interface{}{"operationId": "commitFiles"})
opCommitFiles.WithMapOfAnything(map[string]any{"operationId": "commitFiles"})
_ = reflector.SetRequest(&opCommitFiles, new(commitFilesRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCommitFiles, types.CommitFilesResponse{}, http.StatusOK)
_ = reflector.SetJSONResponse(&opCommitFiles, new(usererror.Error), http.StatusInternalServerError)
@ -1145,7 +1145,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opDiff := openapi3.Operation{}
opDiff.WithTags("repository")
opDiff.WithMapOfAnything(map[string]interface{}{"operationId": "rawDiff"})
opDiff.WithMapOfAnything(map[string]any{"operationId": "rawDiff"})
panicOnErr(reflector.SetRequest(&opDiff, new(getRawDiffRequest), http.MethodGet))
panicOnErr(reflector.SetStringResponse(&opDiff, http.StatusOK, "text/plain"))
panicOnErr(reflector.SetJSONResponse(&opDiff, []git.FileDiff{}, http.StatusOK))
@ -1156,7 +1156,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opPostDiff := openapi3.Operation{}
opPostDiff.WithTags("repository")
opPostDiff.WithMapOfAnything(map[string]interface{}{"operationId": "rawDiffPost"})
opPostDiff.WithMapOfAnything(map[string]any{"operationId": "rawDiffPost"})
panicOnErr(reflector.SetRequest(&opPostDiff, new(postRawDiffRequest), http.MethodPost))
panicOnErr(reflector.SetStringResponse(&opPostDiff, http.StatusOK, "text/plain"))
panicOnErr(reflector.SetJSONResponse(&opPostDiff, []git.FileDiff{}, http.StatusOK))
@ -1167,7 +1167,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opCommitDiff := openapi3.Operation{}
opCommitDiff.WithTags("repository")
opCommitDiff.WithMapOfAnything(map[string]interface{}{"operationId": "getCommitDiff"})
opCommitDiff.WithMapOfAnything(map[string]any{"operationId": "getCommitDiff"})
_ = reflector.SetRequest(&opCommitDiff, new(GetCommitDiffRequest), http.MethodGet)
_ = reflector.SetStringResponse(&opCommitDiff, http.StatusOK, "text/plain")
_ = reflector.SetJSONResponse(&opCommitDiff, new(usererror.Error), http.StatusInternalServerError)
@ -1178,7 +1178,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opDiffStats := openapi3.Operation{}
opDiffStats.WithTags("repository")
opDiffStats.WithMapOfAnything(map[string]interface{}{"operationId": "diffStats"})
opDiffStats.WithMapOfAnything(map[string]any{"operationId": "diffStats"})
_ = reflector.SetRequest(&opDiffStats, new(getRawDiffRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opDiffStats, new(types.DiffStats), http.StatusOK)
_ = reflector.SetJSONResponse(&opDiffStats, new(usererror.Error), http.StatusInternalServerError)
@ -1188,7 +1188,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opMergeCheck := openapi3.Operation{}
opMergeCheck.WithTags("repository")
opMergeCheck.WithMapOfAnything(map[string]interface{}{"operationId": "mergeCheck"})
opMergeCheck.WithMapOfAnything(map[string]any{"operationId": "mergeCheck"})
_ = reflector.SetRequest(&opMergeCheck, new(getRawDiffRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opMergeCheck, new(repo.MergeCheck), http.StatusOK)
_ = reflector.SetJSONResponse(&opMergeCheck, new(usererror.Error), http.StatusInternalServerError)
@ -1198,7 +1198,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opCodeOwnerValidate := openapi3.Operation{}
opCodeOwnerValidate.WithTags("repository")
opCodeOwnerValidate.WithMapOfAnything(map[string]interface{}{"operationId": "codeOwnersValidate"})
opCodeOwnerValidate.WithMapOfAnything(map[string]any{"operationId": "codeOwnersValidate"})
opCodeOwnerValidate.WithParameters(queryParameterGitRef)
_ = reflector.SetRequest(&opCodeOwnerValidate, new(codeOwnersValidate), http.MethodGet)
_ = reflector.SetJSONResponse(&opCodeOwnerValidate, nil, http.StatusOK)
@ -1212,7 +1212,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opSettingsSecurityUpdate := openapi3.Operation{}
opSettingsSecurityUpdate.WithTags("repository")
opSettingsSecurityUpdate.WithMapOfAnything(
map[string]interface{}{"operationId": "updateSecuritySettings"})
map[string]any{"operationId": "updateSecuritySettings"})
_ = reflector.SetRequest(
&opSettingsSecurityUpdate, new(securitySettingsRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&opSettingsSecurityUpdate, new(reposettings.SecuritySettings), http.StatusOK)
@ -1227,7 +1227,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opSettingsSecurityFind := openapi3.Operation{}
opSettingsSecurityFind.WithTags("repository")
opSettingsSecurityFind.WithMapOfAnything(
map[string]interface{}{"operationId": "findSecuritySettings"})
map[string]any{"operationId": "findSecuritySettings"})
_ = reflector.SetRequest(&opSettingsSecurityFind, new(repoRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opSettingsSecurityFind, new(reposettings.SecuritySettings), http.StatusOK)
_ = reflector.SetJSONResponse(&opSettingsSecurityFind, new(usererror.Error), http.StatusBadRequest)
@ -1241,7 +1241,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opSettingsGeneralUpdate := openapi3.Operation{}
opSettingsGeneralUpdate.WithTags("repository")
opSettingsGeneralUpdate.WithMapOfAnything(
map[string]interface{}{"operationId": "updateGeneralSettings"})
map[string]any{"operationId": "updateGeneralSettings"})
_ = reflector.SetRequest(
&opSettingsGeneralUpdate, new(generalSettingsRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&opSettingsGeneralUpdate, new(reposettings.GeneralSettings), http.StatusOK)
@ -1256,7 +1256,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opSettingsGeneralFind := openapi3.Operation{}
opSettingsGeneralFind.WithTags("repository")
opSettingsGeneralFind.WithMapOfAnything(
map[string]interface{}{"operationId": "findGeneralSettings"})
map[string]any{"operationId": "findGeneralSettings"})
_ = reflector.SetRequest(&opSettingsGeneralFind, new(repoRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opSettingsGeneralFind, new(reposettings.GeneralSettings), http.StatusOK)
_ = reflector.SetJSONResponse(&opSettingsGeneralFind, new(usererror.Error), http.StatusBadRequest)
@ -1269,7 +1269,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opArchive := openapi3.Operation{}
opArchive.WithTags("repository")
opArchive.WithMapOfAnything(map[string]interface{}{"operationId": "archive"})
opArchive.WithMapOfAnything(map[string]any{"operationId": "archive"})
opArchive.WithParameters(
queryParamArchivePaths,
queryParamArchivePrefix,
@ -1291,7 +1291,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opSummary := openapi3.Operation{}
opSummary.WithTags("repository")
opSummary.WithMapOfAnything(
map[string]interface{}{"operationId": "summary"})
map[string]any{"operationId": "summary"})
_ = reflector.SetRequest(&opSummary, new(repoRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opSummary, new(types.RepositorySummary), http.StatusOK)
_ = reflector.SetJSONResponse(&opSummary, new(usererror.Error), http.StatusBadRequest)
@ -1304,7 +1304,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opDefineLabel := openapi3.Operation{}
opDefineLabel.WithTags("repository")
opDefineLabel.WithMapOfAnything(
map[string]interface{}{"operationId": "defineRepoLabel"})
map[string]any{"operationId": "defineRepoLabel"})
_ = reflector.SetRequest(&opDefineLabel, &struct {
repoRequest
LabelRequest
@ -1320,7 +1320,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opSaveLabel := openapi3.Operation{}
opSaveLabel.WithTags("repository")
opSaveLabel.WithMapOfAnything(
map[string]interface{}{"operationId": "saveRepoLabel"})
map[string]any{"operationId": "saveRepoLabel"})
_ = reflector.SetRequest(&opSaveLabel, &struct {
repoRequest
types.SaveInput
@ -1336,7 +1336,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opListLabels := openapi3.Operation{}
opListLabels.WithTags("repository")
opListLabels.WithMapOfAnything(
map[string]interface{}{"operationId": "listRepoLabels"})
map[string]any{"operationId": "listRepoLabels"})
opListLabels.WithParameters(
QueryParameterPage, QueryParameterLimit, QueryParameterInherited, QueryParameterQueryLabel)
_ = reflector.SetRequest(&opListLabels, new(repoRequest), http.MethodGet)
@ -1351,7 +1351,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opDeleteLabel := openapi3.Operation{}
opDeleteLabel.WithTags("repository")
opDeleteLabel.WithMapOfAnything(
map[string]interface{}{"operationId": "deleteRepoLabel"})
map[string]any{"operationId": "deleteRepoLabel"})
_ = reflector.SetRequest(&opDeleteLabel, &struct {
repoRequest
Key string `path:"key"`
@ -1368,7 +1368,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opFindLabel := openapi3.Operation{}
opFindLabel.WithTags("repository")
opFindLabel.WithMapOfAnything(
map[string]interface{}{"operationId": "findRepoLabel"})
map[string]any{"operationId": "findRepoLabel"})
opFindLabel.WithParameters(queryParameterIncludeValues)
_ = reflector.SetRequest(&opFindLabel, &struct {
repoRequest
@ -1385,7 +1385,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opUpdateLabel := openapi3.Operation{}
opUpdateLabel.WithTags("repository")
opUpdateLabel.WithMapOfAnything(
map[string]interface{}{"operationId": "updateRepoLabel"})
map[string]any{"operationId": "updateRepoLabel"})
_ = reflector.SetRequest(&opUpdateLabel, &struct {
repoRequest
LabelRequest
@ -1402,7 +1402,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opDefineLabelValue := openapi3.Operation{}
opDefineLabelValue.WithTags("repository")
opDefineLabelValue.WithMapOfAnything(
map[string]interface{}{"operationId": "defineRepoLabelValue"})
map[string]any{"operationId": "defineRepoLabelValue"})
_ = reflector.SetRequest(&opDefineLabelValue, &struct {
repoRequest
LabelValueRequest
@ -1420,7 +1420,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opListLabelValues := openapi3.Operation{}
opListLabelValues.WithTags("repository")
opListLabelValues.WithMapOfAnything(
map[string]interface{}{"operationId": "listRepoLabelValues"})
map[string]any{"operationId": "listRepoLabelValues"})
_ = reflector.SetRequest(&opListLabelValues, &struct {
repoRequest
Key string `path:"key"`
@ -1437,7 +1437,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opDeleteLabelValue := openapi3.Operation{}
opDeleteLabelValue.WithTags("repository")
opDeleteLabelValue.WithMapOfAnything(
map[string]interface{}{"operationId": "deleteRepoLabelValue"})
map[string]any{"operationId": "deleteRepoLabelValue"})
_ = reflector.SetRequest(&opDeleteLabelValue, &struct {
repoRequest
Key string `path:"key"`
@ -1455,7 +1455,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opUpdateLabelValue := openapi3.Operation{}
opUpdateLabelValue.WithTags("repository")
opUpdateLabelValue.WithMapOfAnything(
map[string]interface{}{"operationId": "updateRepoLabelValue"})
map[string]any{"operationId": "updateRepoLabelValue"})
_ = reflector.SetRequest(&opUpdateLabelValue, &struct {
repoRequest
LabelValueRequest
@ -1474,7 +1474,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opRebaseBranch := openapi3.Operation{}
opRebaseBranch.WithTags("repository")
opRebaseBranch.WithMapOfAnything(
map[string]interface{}{"operationId": "rebaseBranch"})
map[string]any{"operationId": "rebaseBranch"})
_ = reflector.SetRequest(&opRebaseBranch, &struct {
repoRequest
repo.RebaseInput
@ -1492,7 +1492,7 @@ func repoOperations(reflector *openapi3.Reflector) {
opSquashBranch := openapi3.Operation{}
opSquashBranch.WithTags("repository")
opSquashBranch.WithMapOfAnything(
map[string]interface{}{"operationId": "squashBranch"})
map[string]any{"operationId": "squashBranch"})
_ = reflector.SetRequest(&opSquashBranch, &struct {
repoRequest
repo.SquashInput

View File

@ -25,7 +25,7 @@ import (
func resourceOperations(reflector *openapi3.Reflector) {
opListGitignore := openapi3.Operation{}
opListGitignore.WithTags("resource")
opListGitignore.WithMapOfAnything(map[string]interface{}{"operationId": "listGitignore"})
opListGitignore.WithMapOfAnything(map[string]any{"operationId": "listGitignore"})
_ = reflector.SetRequest(&opListGitignore, new(gitignoreRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opListGitignore, []string{}, http.StatusOK)
_ = reflector.SetJSONResponse(&opListGitignore, new(usererror.Error), http.StatusInternalServerError)
@ -35,7 +35,7 @@ func resourceOperations(reflector *openapi3.Reflector) {
opListLicenses := openapi3.Operation{}
opListLicenses.WithTags("resource")
opListLicenses.WithMapOfAnything(map[string]interface{}{"operationId": "listLicenses"})
opListLicenses.WithMapOfAnything(map[string]any{"operationId": "listLicenses"})
_ = reflector.SetRequest(&opListLicenses, new(licenseRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opListLicenses, []struct {
Label string `json:"label"`

View File

@ -31,15 +31,15 @@ import (
// RuleType is a plugin for types.RuleType to allow using oneof.
type RuleType string
func (RuleType) Enum() []interface{} {
return []interface{}{protection.TypeBranch, protection.TypeTag, protection.TypePush}
func (RuleType) Enum() []any {
return []any{protection.TypeBranch, protection.TypeTag, protection.TypePush}
}
// RuleDefinition is a plugin for types.Rule Definition to allow using oneof.
type RuleDefinition struct{}
func (RuleDefinition) JSONSchemaOneOf() []interface{} {
return []interface{}{protection.Branch{}, protection.Tag{}, protection.Push{}}
func (RuleDefinition) JSONSchemaOneOf() []any {
return []any{protection.Branch{}, protection.Tag{}, protection.Push{}}
}
type Rule struct {
@ -111,7 +111,7 @@ var queryParameterSortRuleList = openapi3.ParameterOrRef{
func rulesOperations(reflector *openapi3.Reflector) {
opSpaceRuleAdd := openapi3.Operation{}
opSpaceRuleAdd.WithTags("space")
opSpaceRuleAdd.WithMapOfAnything(map[string]interface{}{"operationId": "spaceRuleAdd"})
opSpaceRuleAdd.WithMapOfAnything(map[string]any{"operationId": "spaceRuleAdd"})
_ = reflector.SetRequest(&opSpaceRuleAdd, struct {
spaceRequest
rules.CreateInput
@ -129,7 +129,7 @@ func rulesOperations(reflector *openapi3.Reflector) {
opSpaceRuleDelete := openapi3.Operation{}
opSpaceRuleDelete.WithTags("space")
opSpaceRuleDelete.WithMapOfAnything(map[string]interface{}{"operationId": "spaceRuleDelete"})
opSpaceRuleDelete.WithMapOfAnything(map[string]any{"operationId": "spaceRuleDelete"})
_ = reflector.SetRequest(&opSpaceRuleDelete, struct {
spaceRequest
RuleIdentifier string `path:"rule_identifier"`
@ -143,7 +143,7 @@ func rulesOperations(reflector *openapi3.Reflector) {
opSpaceRuleUpdate := openapi3.Operation{}
opSpaceRuleUpdate.WithTags("space")
opSpaceRuleUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "spaceRuleUpdate"})
opSpaceRuleUpdate.WithMapOfAnything(map[string]any{"operationId": "spaceRuleUpdate"})
_ = reflector.SetRequest(&opSpaceRuleUpdate, &struct {
spaceRequest
Identifier string `path:"rule_identifier"`
@ -162,7 +162,7 @@ func rulesOperations(reflector *openapi3.Reflector) {
opSpaceRuleList := openapi3.Operation{}
opSpaceRuleList.WithTags("space")
opSpaceRuleList.WithMapOfAnything(map[string]interface{}{"operationId": "spaceRuleList"})
opSpaceRuleList.WithMapOfAnything(map[string]any{"operationId": "spaceRuleList"})
opSpaceRuleList.WithParameters(
queryParameterQueryRuleList, QueryParameterRuleTypes,
queryParameterOrder, queryParameterSortRuleList,
@ -179,7 +179,7 @@ func rulesOperations(reflector *openapi3.Reflector) {
opSpaceRuleGet := openapi3.Operation{}
opSpaceRuleGet.WithTags("space")
opSpaceRuleGet.WithMapOfAnything(map[string]interface{}{"operationId": "spaceRuleGet"})
opSpaceRuleGet.WithMapOfAnything(map[string]any{"operationId": "spaceRuleGet"})
_ = reflector.SetRequest(&opSpaceRuleGet, &struct {
spaceRequest
Identifier string `path:"rule_identifier"`
@ -193,7 +193,7 @@ func rulesOperations(reflector *openapi3.Reflector) {
opRepoRuleAdd := openapi3.Operation{}
opRepoRuleAdd.WithTags("repository")
opRepoRuleAdd.WithMapOfAnything(map[string]interface{}{"operationId": "repoRuleAdd"})
opRepoRuleAdd.WithMapOfAnything(map[string]any{"operationId": "repoRuleAdd"})
_ = reflector.SetRequest(&opRepoRuleAdd, struct {
repoRequest
rules.CreateInput
@ -211,7 +211,7 @@ func rulesOperations(reflector *openapi3.Reflector) {
opRepoRuleDelete := openapi3.Operation{}
opRepoRuleDelete.WithTags("repository")
opRepoRuleDelete.WithMapOfAnything(map[string]interface{}{"operationId": "repoRuleDelete"})
opRepoRuleDelete.WithMapOfAnything(map[string]any{"operationId": "repoRuleDelete"})
_ = reflector.SetRequest(&opRepoRuleDelete, struct {
repoRequest
RuleIdentifier string `path:"rule_identifier"`
@ -225,7 +225,7 @@ func rulesOperations(reflector *openapi3.Reflector) {
opRepoRuleUpdate := openapi3.Operation{}
opRepoRuleUpdate.WithTags("repository")
opRepoRuleUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "repoRuleUpdate"})
opRepoRuleUpdate.WithMapOfAnything(map[string]any{"operationId": "repoRuleUpdate"})
_ = reflector.SetRequest(&opRepoRuleUpdate, &struct {
repoRequest
Identifier string `path:"rule_identifier"`
@ -244,7 +244,7 @@ func rulesOperations(reflector *openapi3.Reflector) {
opRepoRuleList := openapi3.Operation{}
opRepoRuleList.WithTags("repository")
opRepoRuleList.WithMapOfAnything(map[string]interface{}{"operationId": "repoRuleList"})
opRepoRuleList.WithMapOfAnything(map[string]any{"operationId": "repoRuleList"})
opRepoRuleList.WithParameters(
queryParameterQueryRuleList, QueryParameterRuleTypes,
queryParameterOrder, queryParameterSortRuleList,
@ -261,7 +261,7 @@ func rulesOperations(reflector *openapi3.Reflector) {
opRepoRuleGet := openapi3.Operation{}
opRepoRuleGet.WithTags("repository")
opRepoRuleGet.WithMapOfAnything(map[string]interface{}{"operationId": "repoRuleGet"})
opRepoRuleGet.WithMapOfAnything(map[string]any{"operationId": "repoRuleGet"})
_ = reflector.SetRequest(&opRepoRuleGet, &struct {
repoRequest
Identifier string `path:"rule_identifier"`

View File

@ -44,7 +44,7 @@ type updateSecretRequest struct {
func secretOperations(reflector *openapi3.Reflector) {
opCreate := openapi3.Operation{}
opCreate.WithTags("secret")
opCreate.WithMapOfAnything(map[string]interface{}{"operationId": "createSecret"})
opCreate.WithMapOfAnything(map[string]any{"operationId": "createSecret"})
_ = reflector.SetRequest(&opCreate, new(createSecretRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreate, new(types.Secret), http.StatusCreated)
_ = reflector.SetJSONResponse(&opCreate, new(usererror.Error), http.StatusBadRequest)
@ -55,7 +55,7 @@ func secretOperations(reflector *openapi3.Reflector) {
opFind := openapi3.Operation{}
opFind.WithTags("secret")
opFind.WithMapOfAnything(map[string]interface{}{"operationId": "findSecret"})
opFind.WithMapOfAnything(map[string]any{"operationId": "findSecret"})
_ = reflector.SetRequest(&opFind, new(getSecretRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opFind, new(types.Secret), http.StatusOK)
_ = reflector.SetJSONResponse(&opFind, new(usererror.Error), http.StatusInternalServerError)
@ -66,7 +66,7 @@ func secretOperations(reflector *openapi3.Reflector) {
opDelete := openapi3.Operation{}
opDelete.WithTags("secret")
opDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deleteSecret"})
opDelete.WithMapOfAnything(map[string]any{"operationId": "deleteSecret"})
_ = reflector.SetRequest(&opDelete, new(getSecretRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&opDelete, new(usererror.Error), http.StatusInternalServerError)
@ -77,7 +77,7 @@ func secretOperations(reflector *openapi3.Reflector) {
opUpdate := openapi3.Operation{}
opUpdate.WithTags("secret")
opUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "updateSecret"})
opUpdate.WithMapOfAnything(map[string]any{"operationId": "updateSecret"})
_ = reflector.SetRequest(&opUpdate, new(updateSecretRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&opUpdate, new(types.Secret), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdate, new(usererror.Error), http.StatusBadRequest)

View File

@ -75,7 +75,7 @@ var queryParameterSortRepo = openapi3.ParameterOrRef{
Schema: &openapi3.Schema{
Type: ptrSchemaType(openapi3.SchemaTypeString),
Default: ptrptr(enum.RepoAttrIdentifier.String()),
Enum: []interface{}{
Enum: []any{
ptr.String(enum.RepoAttrIdentifier.String()),
ptr.String(enum.RepoAttrCreated.String()),
ptr.String(enum.RepoAttrUpdated.String()),
@ -111,7 +111,7 @@ var queryParameterSortSpace = openapi3.ParameterOrRef{
Schema: &openapi3.Schema{
Type: ptrSchemaType(openapi3.SchemaTypeString),
Default: ptrptr(enum.SpaceAttrIdentifier.String()),
Enum: []interface{}{
Enum: []any{
ptr.String(enum.SpaceAttrIdentifier.String()),
ptr.String(enum.SpaceAttrCreated.String()),
ptr.String(enum.SpaceAttrUpdated.String()),
@ -242,7 +242,7 @@ var QueryParameterQueryUsergroup = openapi3.ParameterOrRef{
func spaceOperations(reflector *openapi3.Reflector) {
opCreate := openapi3.Operation{}
opCreate.WithTags("space")
opCreate.WithMapOfAnything(map[string]interface{}{"operationId": "createSpace"})
opCreate.WithMapOfAnything(map[string]any{"operationId": "createSpace"})
_ = reflector.SetRequest(&opCreate, new(createSpaceRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreate, new(space.SpaceOutput), http.StatusCreated)
_ = reflector.SetJSONResponse(&opCreate, new(usererror.Error), http.StatusBadRequest)
@ -253,7 +253,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opImport := openapi3.Operation{}
opImport.WithTags("space")
opImport.WithMapOfAnything(map[string]interface{}{"operationId": "importSpace"})
opImport.WithMapOfAnything(map[string]any{"operationId": "importSpace"})
_ = reflector.SetRequest(&opImport, new(space.ImportInput), http.MethodPost)
_ = reflector.SetJSONResponse(&opImport, new(space.SpaceOutput), http.StatusCreated)
_ = reflector.SetJSONResponse(&opImport, new(usererror.Error), http.StatusBadRequest)
@ -264,7 +264,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opImportRepositories := openapi3.Operation{}
opImportRepositories.WithTags("space")
opImportRepositories.WithMapOfAnything(map[string]interface{}{"operationId": "importSpaceRepositories"})
opImportRepositories.WithMapOfAnything(map[string]any{"operationId": "importSpaceRepositories"})
_ = reflector.SetRequest(&opImportRepositories, new(importRepositoriesRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opImportRepositories, new(space.ImportRepositoriesOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opImportRepositories, new(usererror.Error), http.StatusBadRequest)
@ -275,7 +275,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opExport := openapi3.Operation{}
opExport.WithTags("space")
opExport.WithMapOfAnything(map[string]interface{}{"operationId": "exportSpace"})
opExport.WithMapOfAnything(map[string]any{"operationId": "exportSpace"})
_ = reflector.SetRequest(&opExport, new(exportSpaceRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opExport, nil, http.StatusAccepted)
_ = reflector.SetJSONResponse(&opExport, new(usererror.Error), http.StatusBadRequest)
@ -286,7 +286,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opExportProgress := openapi3.Operation{}
opExportProgress.WithTags("space")
opExportProgress.WithMapOfAnything(map[string]interface{}{"operationId": "exportProgressSpace"})
opExportProgress.WithMapOfAnything(map[string]any{"operationId": "exportProgressSpace"})
_ = reflector.SetRequest(&opExportProgress, new(spaceRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opExportProgress, new(space.ExportProgressOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opExportProgress, new(usererror.Error), http.StatusBadRequest)
@ -297,7 +297,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opGet := openapi3.Operation{}
opGet.WithTags("space")
opGet.WithMapOfAnything(map[string]interface{}{"operationId": "getSpace"})
opGet.WithMapOfAnything(map[string]any{"operationId": "getSpace"})
_ = reflector.SetRequest(&opGet, new(spaceRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opGet, new(space.SpaceOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opGet, new(usererror.Error), http.StatusInternalServerError)
@ -308,7 +308,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opUpdate := openapi3.Operation{}
opUpdate.WithTags("space")
opUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "updateSpace"})
opUpdate.WithMapOfAnything(map[string]any{"operationId": "updateSpace"})
_ = reflector.SetRequest(&opUpdate, new(updateSpaceRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&opUpdate, new(space.SpaceOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdate, new(usererror.Error), http.StatusBadRequest)
@ -321,7 +321,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opUpdatePublicAccess := openapi3.Operation{}
opUpdatePublicAccess.WithTags("space")
opUpdatePublicAccess.WithMapOfAnything(
map[string]interface{}{"operationId": "updateSpacePublicAccess"})
map[string]any{"operationId": "updateSpacePublicAccess"})
_ = reflector.SetRequest(
&opUpdatePublicAccess, new(updateSpacePublicAccessRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opUpdatePublicAccess, new(space.SpaceOutput), http.StatusOK)
@ -335,7 +335,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opDelete := openapi3.Operation{}
opDelete.WithTags("space")
opDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deleteSpace"})
opDelete.WithMapOfAnything(map[string]any{"operationId": "deleteSpace"})
_ = reflector.SetRequest(&opDelete, new(spaceRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDelete, new(space.SoftDeleteResponse), http.StatusOK)
_ = reflector.SetJSONResponse(&opDelete, new(usererror.Error), http.StatusInternalServerError)
@ -346,7 +346,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opPurge := openapi3.Operation{}
opPurge.WithTags("space")
opPurge.WithMapOfAnything(map[string]interface{}{"operationId": "purgeSpace"})
opPurge.WithMapOfAnything(map[string]any{"operationId": "purgeSpace"})
opPurge.WithParameters(queryParameterDeletedAt)
_ = reflector.SetRequest(&opPurge, new(spaceRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opPurge, nil, http.StatusNoContent)
@ -358,7 +358,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opRestore := openapi3.Operation{}
opRestore.WithTags("space")
opRestore.WithMapOfAnything(map[string]interface{}{"operationId": "restoreSpace"})
opRestore.WithMapOfAnything(map[string]any{"operationId": "restoreSpace"})
opRestore.WithParameters(queryParameterDeletedAt)
_ = reflector.SetRequest(&opRestore, new(restoreSpaceRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opRestore, new(space.SpaceOutput), http.StatusOK)
@ -371,7 +371,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opMove := openapi3.Operation{}
opMove.WithTags("space")
opMove.WithMapOfAnything(map[string]interface{}{"operationId": "moveSpace"})
opMove.WithMapOfAnything(map[string]any{"operationId": "moveSpace"})
_ = reflector.SetRequest(&opMove, new(moveSpaceRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opMove, new(space.SpaceOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opMove, new(usererror.Error), http.StatusBadRequest)
@ -382,7 +382,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opSpaces := openapi3.Operation{}
opSpaces.WithTags("space")
opSpaces.WithMapOfAnything(map[string]interface{}{"operationId": "listSpaces"})
opSpaces.WithMapOfAnything(map[string]any{"operationId": "listSpaces"})
opSpaces.WithParameters(QueryParameterPage, QueryParameterLimit)
opSpaces.WithParameters(queryParameterQuerySpace, queryParameterSortSpace, queryParameterOrder,
QueryParameterPage, QueryParameterLimit)
@ -396,7 +396,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opRepos := openapi3.Operation{}
opRepos.WithTags("space")
opRepos.WithMapOfAnything(map[string]interface{}{"operationId": "listRepos"})
opRepos.WithMapOfAnything(map[string]any{"operationId": "listRepos"})
opRepos.WithParameters(queryParameterQueryRepo, queryParameterSortRepo, queryParameterOrder,
QueryParameterPage, QueryParameterLimit, QueryParameterRecursive, queryParameterOnlyFavorites)
_ = reflector.SetRequest(&opRepos, new(spaceRequest), http.MethodGet)
@ -409,7 +409,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opPipelines := openapi3.Operation{}
opPipelines.WithTags("space")
opPipelines.WithMapOfAnything(map[string]interface{}{"operationId": "listSpacePipelines"})
opPipelines.WithMapOfAnything(map[string]any{"operationId": "listSpacePipelines"})
opPipelines.WithParameters(queryParameterQueryPipeline, QueryParameterPage,
QueryParameterLimit, queryParameterLastExecutions)
_ = reflector.SetRequest(&opPipelines, new(spaceRequest), http.MethodGet)
@ -422,7 +422,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opExecutions := openapi3.Operation{}
opExecutions.WithTags("space")
opExecutions.WithMapOfAnything(map[string]interface{}{"operationId": "listSpaceExecutions"})
opExecutions.WithMapOfAnything(map[string]any{"operationId": "listSpaceExecutions"})
opExecutions.WithParameters(queryParameterQueryExecution, QueryParameterPage, QueryParameterLimit,
queryParameterSortExecution, queryParameterOrder, queryParameterPipelineIdentifier)
_ = reflector.SetRequest(&opExecutions, new(spaceRequest), http.MethodGet)
@ -435,7 +435,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opTemplates := openapi3.Operation{}
opTemplates.WithTags("space")
opTemplates.WithMapOfAnything(map[string]interface{}{"operationId": "listTemplates"})
opTemplates.WithMapOfAnything(map[string]any{"operationId": "listTemplates"})
opTemplates.WithParameters(queryParameterQueryRepo, QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&opTemplates, new(spaceRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opTemplates, []types.Template{}, http.StatusOK)
@ -447,7 +447,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opConnectors := openapi3.Operation{}
opConnectors.WithTags("space")
opConnectors.WithMapOfAnything(map[string]interface{}{"operationId": "listConnectors"})
opConnectors.WithMapOfAnything(map[string]any{"operationId": "listConnectors"})
opConnectors.WithParameters(queryParameterQueryRepo, QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&opConnectors, new(spaceRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opConnectors, []types.Connector{}, http.StatusOK)
@ -459,7 +459,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opSecrets := openapi3.Operation{}
opSecrets.WithTags("space")
opSecrets.WithMapOfAnything(map[string]interface{}{"operationId": "listSecrets"})
opSecrets.WithMapOfAnything(map[string]any{"operationId": "listSecrets"})
opSecrets.WithParameters(queryParameterQueryRepo, QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&opSecrets, new(spaceRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opSecrets, []types.Secret{}, http.StatusOK)
@ -471,7 +471,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opServiceAccounts := openapi3.Operation{}
opServiceAccounts.WithTags("space")
opServiceAccounts.WithMapOfAnything(map[string]interface{}{"operationId": "listServiceAccounts"})
opServiceAccounts.WithMapOfAnything(map[string]any{"operationId": "listServiceAccounts"})
_ = reflector.SetRequest(&opServiceAccounts, new(spaceRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opServiceAccounts, []types.ServiceAccount{}, http.StatusOK)
_ = reflector.SetJSONResponse(&opServiceAccounts, new(usererror.Error), http.StatusInternalServerError)
@ -482,7 +482,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opMembershipAdd := openapi3.Operation{}
opMembershipAdd.WithTags("space")
opMembershipAdd.WithMapOfAnything(map[string]interface{}{"operationId": "membershipAdd"})
opMembershipAdd.WithMapOfAnything(map[string]any{"operationId": "membershipAdd"})
_ = reflector.SetRequest(&opMembershipAdd, struct {
spaceRequest
space.MembershipAddInput
@ -496,7 +496,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opMembershipDelete := openapi3.Operation{}
opMembershipDelete.WithTags("space")
opMembershipDelete.WithMapOfAnything(map[string]interface{}{"operationId": "membershipDelete"})
opMembershipDelete.WithMapOfAnything(map[string]any{"operationId": "membershipDelete"})
_ = reflector.SetRequest(&opMembershipDelete, struct {
spaceRequest
UserUID string `path:"user_uid"`
@ -510,7 +510,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opMembershipUpdate := openapi3.Operation{}
opMembershipUpdate.WithTags("space")
opMembershipUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "membershipUpdate"})
opMembershipUpdate.WithMapOfAnything(map[string]any{"operationId": "membershipUpdate"})
_ = reflector.SetRequest(&opMembershipUpdate, &struct {
spaceRequest
UserUID string `path:"user_uid"`
@ -525,7 +525,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opMembershipList := openapi3.Operation{}
opMembershipList.WithTags("space")
opMembershipList.WithMapOfAnything(map[string]interface{}{"operationId": "membershipList"})
opMembershipList.WithMapOfAnything(map[string]any{"operationId": "membershipList"})
opMembershipList.WithParameters(
queryParameterMembershipUsers,
queryParameterOrder, queryParameterSortMembershipUsers,
@ -543,7 +543,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opDefineLabel := openapi3.Operation{}
opDefineLabel.WithTags("space")
opDefineLabel.WithMapOfAnything(
map[string]interface{}{"operationId": "defineSpaceLabel"})
map[string]any{"operationId": "defineSpaceLabel"})
_ = reflector.SetRequest(&opDefineLabel, &struct {
spaceRequest
LabelRequest
@ -559,7 +559,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opSaveLabel := openapi3.Operation{}
opSaveLabel.WithTags("space")
opSaveLabel.WithMapOfAnything(
map[string]interface{}{"operationId": "saveSpaceLabel"})
map[string]any{"operationId": "saveSpaceLabel"})
_ = reflector.SetRequest(&opSaveLabel, &struct {
spaceRequest
types.SaveInput
@ -575,7 +575,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opListLabels := openapi3.Operation{}
opListLabels.WithTags("space")
opListLabels.WithMapOfAnything(
map[string]interface{}{"operationId": "listSpaceLabels"})
map[string]any{"operationId": "listSpaceLabels"})
opListLabels.WithParameters(
QueryParameterPage, QueryParameterLimit, QueryParameterInherited, QueryParameterQueryLabel)
_ = reflector.SetRequest(&opListLabels, new(spaceRequest), http.MethodGet)
@ -589,7 +589,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opFindLabel := openapi3.Operation{}
opFindLabel.WithTags("space")
opFindLabel.WithMapOfAnything(map[string]interface{}{"operationId": "findSpaceLabel"})
opFindLabel.WithMapOfAnything(map[string]any{"operationId": "findSpaceLabel"})
opFindLabel.WithParameters(queryParameterIncludeValues)
_ = reflector.SetRequest(&opFindLabel, &struct {
spaceRequest
@ -606,7 +606,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opDeleteLabel := openapi3.Operation{}
opDeleteLabel.WithTags("space")
opDeleteLabel.WithMapOfAnything(
map[string]interface{}{"operationId": "deleteSpaceLabel"})
map[string]any{"operationId": "deleteSpaceLabel"})
_ = reflector.SetRequest(&opDeleteLabel, &struct {
spaceRequest
Key string `path:"key"`
@ -623,7 +623,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opUpdateLabel := openapi3.Operation{}
opUpdateLabel.WithTags("space")
opUpdateLabel.WithMapOfAnything(
map[string]interface{}{"operationId": "updateSpaceLabel"})
map[string]any{"operationId": "updateSpaceLabel"})
_ = reflector.SetRequest(&opUpdateLabel, &struct {
spaceRequest
LabelRequest
@ -641,7 +641,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opDefineLabelValue := openapi3.Operation{}
opDefineLabelValue.WithTags("space")
opDefineLabelValue.WithMapOfAnything(
map[string]interface{}{"operationId": "defineSpaceLabelValue"})
map[string]any{"operationId": "defineSpaceLabelValue"})
_ = reflector.SetRequest(&opDefineLabelValue, &struct {
spaceRequest
LabelValueRequest
@ -659,7 +659,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opListLabelValues := openapi3.Operation{}
opListLabelValues.WithTags("space")
opListLabelValues.WithMapOfAnything(
map[string]interface{}{"operationId": "listSpaceLabelValues"})
map[string]any{"operationId": "listSpaceLabelValues"})
_ = reflector.SetRequest(&opListLabelValues, &struct {
spaceRequest
Key string `path:"key"`
@ -676,7 +676,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opDeleteLabelValue := openapi3.Operation{}
opDeleteLabelValue.WithTags("space")
opDeleteLabelValue.WithMapOfAnything(
map[string]interface{}{"operationId": "deleteSpaceLabelValue"})
map[string]any{"operationId": "deleteSpaceLabelValue"})
_ = reflector.SetRequest(&opDeleteLabelValue, &struct {
spaceRequest
Key string `path:"key"`
@ -694,7 +694,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opUpdateLabelValue := openapi3.Operation{}
opUpdateLabelValue.WithTags("space")
opUpdateLabelValue.WithMapOfAnything(
map[string]interface{}{"operationId": "updateSpaceLabelValue"})
map[string]any{"operationId": "updateSpaceLabelValue"})
_ = reflector.SetRequest(&opUpdateLabelValue, &struct {
spaceRequest
LabelValueRequest
@ -712,7 +712,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
countPullReq := openapi3.Operation{}
countPullReq.WithTags("space")
countPullReq.WithMapOfAnything(map[string]interface{}{"operationId": "countSpacePullReq"})
countPullReq.WithMapOfAnything(map[string]any{"operationId": "countSpacePullReq"})
countPullReq.WithParameters(
queryParameterStatePullRequest, queryParameterSourceRepoRefPullRequest,
queryParameterSourceBranchPullRequest, queryParameterTargetBranchPullRequest,
@ -732,7 +732,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
listPullReq := openapi3.Operation{}
listPullReq.WithTags("space")
listPullReq.WithMapOfAnything(map[string]interface{}{"operationId": "listSpacePullReq"})
listPullReq.WithMapOfAnything(map[string]any{"operationId": "listSpacePullReq"})
listPullReq.WithParameters(
queryParameterStatePullRequest, queryParameterSourceRepoRefPullRequest,
queryParameterSourceBranchPullRequest, queryParameterTargetBranchPullRequest,
@ -754,7 +754,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opGetUsageMetrics := openapi3.Operation{}
opGetUsageMetrics.WithTags("space")
opGetUsageMetrics.WithMapOfAnything(map[string]interface{}{"operationId": "getSpaceUsageMetric"})
opGetUsageMetrics.WithMapOfAnything(map[string]any{"operationId": "getSpaceUsageMetric"})
_ = reflector.SetRequest(&opGetUsageMetrics, new(spaceRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opGetUsageMetrics, new(types.UsageMetric), http.StatusOK)
_ = reflector.SetJSONResponse(&opGetUsageMetrics, new(usererror.Error), http.StatusInternalServerError)
@ -764,7 +764,7 @@ func spaceOperations(reflector *openapi3.Reflector) {
opUsergroups := openapi3.Operation{}
opUsergroups.WithTags("space")
opUsergroups.WithMapOfAnything(map[string]interface{}{"operationId": "listUsergroups"})
opUsergroups.WithMapOfAnything(map[string]any{"operationId": "listUsergroups"})
opUsergroups.WithParameters(QueryParameterQueryUsergroup, QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&opUsergroups, new(spaceRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opUsergroups, new([]*types.UserGroupInfo), http.StatusOK)

View File

@ -28,7 +28,7 @@ import (
func buildSystem(reflector *openapi3.Reflector) {
opGetConfig := openapi3.Operation{}
opGetConfig.WithTags("system")
opGetConfig.WithMapOfAnything(map[string]interface{}{"operationId": "getSystemConfig"})
opGetConfig.WithMapOfAnything(map[string]any{"operationId": "getSystemConfig"})
_ = reflector.SetRequest(&opGetConfig, nil, http.MethodGet)
_ = reflector.SetJSONResponse(&opGetConfig, new(system.ConfigOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opGetConfig, new(usererror.Error), http.StatusInternalServerError)

View File

@ -44,7 +44,7 @@ type updateTemplateRequest struct {
func templateOperations(reflector *openapi3.Reflector) {
opCreate := openapi3.Operation{}
opCreate.WithTags("template")
opCreate.WithMapOfAnything(map[string]interface{}{"operationId": "createTemplate"})
opCreate.WithMapOfAnything(map[string]any{"operationId": "createTemplate"})
_ = reflector.SetRequest(&opCreate, new(createTemplateRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreate, new(types.Template), http.StatusCreated)
_ = reflector.SetJSONResponse(&opCreate, new(usererror.Error), http.StatusBadRequest)
@ -55,7 +55,7 @@ func templateOperations(reflector *openapi3.Reflector) {
opFind := openapi3.Operation{}
opFind.WithTags("template")
opFind.WithMapOfAnything(map[string]interface{}{"operationId": "findTemplate"})
opFind.WithMapOfAnything(map[string]any{"operationId": "findTemplate"})
_ = reflector.SetRequest(&opFind, new(getTemplateRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opFind, new(types.Template), http.StatusOK)
_ = reflector.SetJSONResponse(&opFind, new(usererror.Error), http.StatusInternalServerError)
@ -66,7 +66,7 @@ func templateOperations(reflector *openapi3.Reflector) {
opDelete := openapi3.Operation{}
opDelete.WithTags("template")
opDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deleteTemplate"})
opDelete.WithMapOfAnything(map[string]any{"operationId": "deleteTemplate"})
_ = reflector.SetRequest(&opDelete, new(getTemplateRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&opDelete, new(usererror.Error), http.StatusInternalServerError)
@ -77,7 +77,7 @@ func templateOperations(reflector *openapi3.Reflector) {
opUpdate := openapi3.Operation{}
opUpdate.WithTags("template")
opUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "updateTemplate"})
opUpdate.WithMapOfAnything(map[string]any{"operationId": "updateTemplate"})
_ = reflector.SetRequest(&opUpdate, new(updateTemplateRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&opUpdate, new(types.Template), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdate, new(usererror.Error), http.StatusBadRequest)

View File

@ -27,7 +27,7 @@ import (
func uploadOperations(reflector *openapi3.Reflector) {
opUpload := openapi3.Operation{}
opUpload.WithTags("upload")
opUpload.WithMapOfAnything(map[string]interface{}{"operationId": "repoArtifactUpload"})
opUpload.WithMapOfAnything(map[string]any{"operationId": "repoArtifactUpload"})
opUpload.WithRequestBody(openapi3.RequestBodyOrRef{
RequestBody: &openapi3.RequestBody{
Description: ptr.String("Binary file to upload"),
@ -49,7 +49,7 @@ func uploadOperations(reflector *openapi3.Reflector) {
downloadOp := openapi3.Operation{}
downloadOp.WithTags("upload")
downloadOp.WithMapOfAnything(map[string]interface{}{"operationId": "repoArtifactDownload"})
downloadOp.WithMapOfAnything(map[string]any{"operationId": "repoArtifactDownload"})
_ = reflector.SetRequest(&downloadOp, struct {
repoRequest
FilePathRef string `path:"file_ref"`

View File

@ -156,7 +156,7 @@ var QueryParameterResourceType = openapi3.ParameterOrRef{
func buildUser(reflector *openapi3.Reflector) {
opFind := openapi3.Operation{}
opFind.WithTags("user")
opFind.WithMapOfAnything(map[string]interface{}{"operationId": "getUser"})
opFind.WithMapOfAnything(map[string]any{"operationId": "getUser"})
_ = reflector.SetRequest(&opFind, nil, http.MethodGet)
_ = reflector.SetJSONResponse(&opFind, new(types.User), http.StatusOK)
_ = reflector.SetJSONResponse(&opFind, new(usererror.Error), http.StatusInternalServerError)
@ -164,7 +164,7 @@ func buildUser(reflector *openapi3.Reflector) {
opUpdate := openapi3.Operation{}
opUpdate.WithTags("user")
opUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "updateUser"})
opUpdate.WithMapOfAnything(map[string]any{"operationId": "updateUser"})
_ = reflector.SetRequest(&opUpdate, new(user.UpdateInput), http.MethodPatch)
_ = reflector.SetJSONResponse(&opUpdate, new(types.User), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdate, new(usererror.Error), http.StatusInternalServerError)
@ -172,7 +172,7 @@ func buildUser(reflector *openapi3.Reflector) {
opMemberSpaces := openapi3.Operation{}
opMemberSpaces.WithTags("user")
opMemberSpaces.WithMapOfAnything(map[string]interface{}{"operationId": "membershipSpaces"})
opMemberSpaces.WithMapOfAnything(map[string]any{"operationId": "membershipSpaces"})
opMemberSpaces.WithParameters(
queryParameterMembershipSpaces,
queryParameterOrder, queryParameterSortMembershipSpaces,
@ -184,7 +184,7 @@ func buildUser(reflector *openapi3.Reflector) {
opKeyCreate := openapi3.Operation{}
opKeyCreate.WithTags("user")
opKeyCreate.WithMapOfAnything(map[string]interface{}{"operationId": "createPublicKey"})
opKeyCreate.WithMapOfAnything(map[string]any{"operationId": "createPublicKey"})
_ = reflector.SetRequest(&opKeyCreate, new(user.CreatePublicKeyInput), http.MethodPost)
_ = reflector.SetJSONResponse(&opKeyCreate, new(types.PublicKey), http.StatusCreated)
_ = reflector.SetJSONResponse(&opKeyCreate, new(usererror.Error), http.StatusBadRequest)
@ -193,7 +193,7 @@ func buildUser(reflector *openapi3.Reflector) {
opKeyDelete := openapi3.Operation{}
opKeyDelete.WithTags("user")
opKeyDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deletePublicKey"})
opKeyDelete.WithMapOfAnything(map[string]any{"operationId": "deletePublicKey"})
_ = reflector.SetRequest(&opKeyDelete, struct {
ID string `path:"public_key_identifier"`
}{}, http.MethodDelete)
@ -204,7 +204,7 @@ func buildUser(reflector *openapi3.Reflector) {
opKeyUpdate := openapi3.Operation{}
opKeyUpdate.WithTags("user")
opKeyUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "updatePublicKey"})
opKeyUpdate.WithMapOfAnything(map[string]any{"operationId": "updatePublicKey"})
_ = reflector.SetRequest(&opKeyUpdate, struct {
ID string `path:"public_key_identifier"`
}{}, http.MethodPatch)
@ -216,7 +216,7 @@ func buildUser(reflector *openapi3.Reflector) {
opKeyList := openapi3.Operation{}
opKeyList.WithTags("user")
opKeyList.WithMapOfAnything(map[string]interface{}{"operationId": "listPublicKey"})
opKeyList.WithMapOfAnything(map[string]any{"operationId": "listPublicKey"})
opKeyList.WithParameters(QueryParameterPage, QueryParameterLimit,
queryParameterQueryPublicKey, queryParameterSortPublicKey, queryParameterOrder,
queryParameterUsagePublicKey, queryParameterSchemePublicKey,
@ -229,7 +229,7 @@ func buildUser(reflector *openapi3.Reflector) {
opListTokens := openapi3.Operation{}
opListTokens.WithTags("user")
opListTokens.WithMapOfAnything(map[string]interface{}{"operationId": "listTokens"})
opListTokens.WithMapOfAnything(map[string]any{"operationId": "listTokens"})
_ = reflector.SetRequest(&opListTokens, nil, http.MethodGet)
_ = reflector.SetJSONResponse(&opListTokens, new([]types.Token), http.StatusOK)
_ = reflector.SetJSONResponse(&opListTokens, new(usererror.Error), http.StatusUnauthorized)
@ -239,7 +239,7 @@ func buildUser(reflector *openapi3.Reflector) {
opCreateToken := openapi3.Operation{}
opCreateToken.WithTags("user")
opCreateToken.WithMapOfAnything(map[string]interface{}{"operationId": "createToken"})
opCreateToken.WithMapOfAnything(map[string]any{"operationId": "createToken"})
_ = reflector.SetRequest(&opCreateToken, new(user.CreateTokenInput), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreateToken, new(types.TokenResponse), http.StatusCreated)
_ = reflector.SetJSONResponse(&opCreateToken, new(usererror.Error), http.StatusUnauthorized)
@ -249,7 +249,7 @@ func buildUser(reflector *openapi3.Reflector) {
opDeleteToken := openapi3.Operation{}
opDeleteToken.WithTags("user")
opDeleteToken.WithMapOfAnything(map[string]interface{}{"operationId": "deleteToken"})
opDeleteToken.WithMapOfAnything(map[string]any{"operationId": "deleteToken"})
_ = reflector.SetRequest(&opDeleteToken, new(tokensRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDeleteToken, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&opDeleteToken, new(usererror.Error), http.StatusNotFound)
@ -260,7 +260,7 @@ func buildUser(reflector *openapi3.Reflector) {
opCreateFavorite := openapi3.Operation{}
opCreateFavorite.WithTags("user")
opCreateFavorite.WithMapOfAnything(map[string]interface{}{"operationId": "createFavorite"})
opCreateFavorite.WithMapOfAnything(map[string]any{"operationId": "createFavorite"})
_ = reflector.SetRequest(&opCreateFavorite, new(types.FavoriteResource), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreateFavorite, new(types.FavoriteResource), http.StatusCreated)
_ = reflector.SetJSONResponse(&opCreateFavorite, new(usererror.Error), http.StatusUnauthorized)
@ -270,7 +270,7 @@ func buildUser(reflector *openapi3.Reflector) {
opDeleteFavorite := openapi3.Operation{}
opDeleteFavorite.WithTags("user")
opDeleteFavorite.WithMapOfAnything(map[string]interface{}{"operationId": "deleteFavorite"})
opDeleteFavorite.WithMapOfAnything(map[string]any{"operationId": "deleteFavorite"})
opDeleteFavorite.WithParameters(QueryParameterResourceType)
_ = reflector.SetRequest(&opDeleteFavorite, new(favoriteRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDeleteFavorite, nil, http.StatusNoContent)

View File

@ -62,7 +62,7 @@ type (
func buildAdmin(reflector *openapi3.Reflector) {
opFind := openapi3.Operation{}
opFind.WithTags("admin")
opFind.WithMapOfAnything(map[string]interface{}{"operationId": "adminGetUser"})
opFind.WithMapOfAnything(map[string]any{"operationId": "adminGetUser"})
_ = reflector.SetRequest(&opFind, new(adminUsersRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opFind, new(types.User), http.StatusOK)
_ = reflector.SetJSONResponse(&opFind, new(usererror.Error), http.StatusBadRequest)
@ -72,7 +72,7 @@ func buildAdmin(reflector *openapi3.Reflector) {
opList := openapi3.Operation{}
opList.WithTags("admin")
opList.WithMapOfAnything(map[string]interface{}{"operationId": "adminListUsers"})
opList.WithMapOfAnything(map[string]any{"operationId": "adminListUsers"})
_ = reflector.SetRequest(&opList, new(adminUserListRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&opList, new([]*types.User), http.StatusOK)
_ = reflector.SetJSONResponse(&opList, new(usererror.Error), http.StatusBadRequest)
@ -82,7 +82,7 @@ func buildAdmin(reflector *openapi3.Reflector) {
opCreate := openapi3.Operation{}
opCreate.WithTags("admin")
opCreate.WithMapOfAnything(map[string]interface{}{"operationId": "adminCreateUser"})
opCreate.WithMapOfAnything(map[string]any{"operationId": "adminCreateUser"})
_ = reflector.SetRequest(&opCreate, new(adminUsersCreateRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opCreate, new(types.User), http.StatusCreated)
_ = reflector.SetJSONResponse(&opCreate, new(usererror.Error), http.StatusBadRequest)
@ -92,7 +92,7 @@ func buildAdmin(reflector *openapi3.Reflector) {
opUpdate := openapi3.Operation{}
opUpdate.WithTags("admin")
opUpdate.WithMapOfAnything(map[string]interface{}{"operationId": "adminUpdateUser"})
opUpdate.WithMapOfAnything(map[string]any{"operationId": "adminUpdateUser"})
_ = reflector.SetRequest(&opUpdate, new(adminUsersUpdateRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&opUpdate, new(types.User), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdate, new(usererror.Error), http.StatusBadRequest)
@ -102,7 +102,7 @@ func buildAdmin(reflector *openapi3.Reflector) {
opUpdateAdmin := openapi3.Operation{}
opUpdateAdmin.WithTags("admin")
opUpdateAdmin.WithMapOfAnything(map[string]interface{}{"operationId": "updateUserAdmin"})
opUpdateAdmin.WithMapOfAnything(map[string]any{"operationId": "updateUserAdmin"})
_ = reflector.SetRequest(&opUpdateAdmin, new(updateAdminRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&opUpdateAdmin, new(types.User), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdateAdmin, new(usererror.Error), http.StatusNotFound)
@ -111,7 +111,7 @@ func buildAdmin(reflector *openapi3.Reflector) {
opDelete := openapi3.Operation{}
opDelete.WithTags("admin")
opDelete.WithMapOfAnything(map[string]interface{}{"operationId": "adminDeleteUser"})
opDelete.WithMapOfAnything(map[string]any{"operationId": "adminDeleteUser"})
_ = reflector.SetRequest(&opDelete, new(adminUsersRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&opDelete, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&opDelete, new(usererror.Error), http.StatusInternalServerError)

View File

@ -122,7 +122,7 @@ var queryParameterSortWebhook = openapi3.ParameterOrRef{
Schema: &openapi3.Schema{
Type: ptrSchemaType(openapi3.SchemaTypeString),
Default: ptrptr(enum.WebhookAttrIdentifier.String()),
Enum: []interface{}{
Enum: []any{
// TODO [CODE-1364]: Remove once UID/Identifier migration is completed.
ptr.String(enum.WebhookAttrID.String()),
ptr.String(enum.WebhookAttrUID.String()),
@ -156,7 +156,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
createSpaceWebhook := openapi3.Operation{}
createSpaceWebhook.WithTags("webhook")
createSpaceWebhook.WithMapOfAnything(map[string]interface{}{"operationId": "createSpaceWebhook"})
createSpaceWebhook.WithMapOfAnything(map[string]any{"operationId": "createSpaceWebhook"})
_ = reflector.SetRequest(&createSpaceWebhook, new(createSpaceWebhookRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&createSpaceWebhook, new(webhookType), http.StatusCreated)
_ = reflector.SetJSONResponse(&createSpaceWebhook, new(usererror.Error), http.StatusBadRequest)
@ -167,7 +167,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
listSpaceWebhooks := openapi3.Operation{}
listSpaceWebhooks.WithTags("webhook")
listSpaceWebhooks.WithMapOfAnything(map[string]interface{}{"operationId": "listSpaceWebhooks"})
listSpaceWebhooks.WithMapOfAnything(map[string]any{"operationId": "listSpaceWebhooks"})
listSpaceWebhooks.WithParameters(queryParameterQueryWebhook, queryParameterSortWebhook, queryParameterOrder,
QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&listSpaceWebhooks, new(listSpaceWebhooksRequest), http.MethodGet)
@ -180,7 +180,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
getSpaceWebhook := openapi3.Operation{}
getSpaceWebhook.WithTags("webhook")
getSpaceWebhook.WithMapOfAnything(map[string]interface{}{"operationId": "getSpaceWebhook"})
getSpaceWebhook.WithMapOfAnything(map[string]any{"operationId": "getSpaceWebhook"})
_ = reflector.SetRequest(&getSpaceWebhook, new(getSpaceWebhookRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&getSpaceWebhook, new(webhookType), http.StatusOK)
_ = reflector.SetJSONResponse(&getSpaceWebhook, new(usererror.Error), http.StatusBadRequest)
@ -191,7 +191,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
updateSpaceWebhook := openapi3.Operation{}
updateSpaceWebhook.WithTags("webhook")
updateSpaceWebhook.WithMapOfAnything(map[string]interface{}{"operationId": "updateWebhook"})
updateSpaceWebhook.WithMapOfAnything(map[string]any{"operationId": "updateWebhook"})
_ = reflector.SetRequest(&updateSpaceWebhook, new(updateSpaceWebhookRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&updateSpaceWebhook, new(webhookType), http.StatusOK)
_ = reflector.SetJSONResponse(&updateSpaceWebhook, new(usererror.Error), http.StatusBadRequest)
@ -204,7 +204,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
deleteSpaceWebhook := openapi3.Operation{}
deleteSpaceWebhook.WithTags("webhook")
deleteSpaceWebhook.WithMapOfAnything(map[string]interface{}{"operationId": "deleteWebhook"})
deleteSpaceWebhook.WithMapOfAnything(map[string]any{"operationId": "deleteWebhook"})
_ = reflector.SetRequest(&deleteSpaceWebhook, new(deleteSpaceWebhookRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&deleteSpaceWebhook, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&deleteSpaceWebhook, new(usererror.Error), http.StatusBadRequest)
@ -217,7 +217,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
listSpaceWebhookExecutions := openapi3.Operation{}
listSpaceWebhookExecutions.WithTags("webhook")
listSpaceWebhookExecutions.WithMapOfAnything(map[string]interface{}{"operationId": "listSpaceWebhookExecutions"})
listSpaceWebhookExecutions.WithMapOfAnything(map[string]any{"operationId": "listSpaceWebhookExecutions"})
listSpaceWebhookExecutions.WithParameters(QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&listSpaceWebhookExecutions, new(listSpaceWebhookExecutionsRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&listSpaceWebhookExecutions, new([]types.WebhookExecution), http.StatusOK)
@ -230,7 +230,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
getSpaceWebhookExecution := openapi3.Operation{}
getSpaceWebhookExecution.WithTags("webhook")
getSpaceWebhookExecution.WithMapOfAnything(map[string]interface{}{"operationId": "getSpaceWebhookExecution"})
getSpaceWebhookExecution.WithMapOfAnything(map[string]any{"operationId": "getSpaceWebhookExecution"})
getSpaceWebhookExecution.WithParameters(QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&getSpaceWebhookExecution, new(getSpaceWebhookExecutionRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&getSpaceWebhookExecution, new(types.WebhookExecution), http.StatusOK)
@ -246,7 +246,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
retriggerSpaceWebhookExecution := openapi3.Operation{}
retriggerSpaceWebhookExecution.WithTags("webhook")
retriggerSpaceWebhookExecution.WithMapOfAnything(
map[string]interface{}{"operationId": "retriggerSpaceWebhookExecution"},
map[string]any{"operationId": "retriggerSpaceWebhookExecution"},
)
_ = reflector.SetRequest(&retriggerSpaceWebhookExecution, new(spaceWebhookExecutionRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&retriggerSpaceWebhookExecution, new(types.WebhookExecution), http.StatusOK)
@ -263,7 +263,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
createRepoWebhook := openapi3.Operation{}
createRepoWebhook.WithTags("webhook")
createRepoWebhook.WithMapOfAnything(map[string]interface{}{"operationId": "createRepoWebhook"})
createRepoWebhook.WithMapOfAnything(map[string]any{"operationId": "createRepoWebhook"})
_ = reflector.SetRequest(&createRepoWebhook, new(createRepoWebhookRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&createRepoWebhook, new(webhookType), http.StatusCreated)
_ = reflector.SetJSONResponse(&createRepoWebhook, new(usererror.Error), http.StatusBadRequest)
@ -274,7 +274,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
listRepoWebhooks := openapi3.Operation{}
listRepoWebhooks.WithTags("webhook")
listRepoWebhooks.WithMapOfAnything(map[string]interface{}{"operationId": "listRepoWebhooks"})
listRepoWebhooks.WithMapOfAnything(map[string]any{"operationId": "listRepoWebhooks"})
listRepoWebhooks.WithParameters(queryParameterQueryWebhook, queryParameterSortWebhook, queryParameterOrder,
QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&listRepoWebhooks, new(listRepoWebhooksRequest), http.MethodGet)
@ -287,7 +287,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
getRepoWebhook := openapi3.Operation{}
getRepoWebhook.WithTags("webhook")
getRepoWebhook.WithMapOfAnything(map[string]interface{}{"operationId": "getRepoWebhook"})
getRepoWebhook.WithMapOfAnything(map[string]any{"operationId": "getRepoWebhook"})
_ = reflector.SetRequest(&getRepoWebhook, new(getRepoWebhookRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&getRepoWebhook, new(webhookType), http.StatusOK)
_ = reflector.SetJSONResponse(&getRepoWebhook, new(usererror.Error), http.StatusBadRequest)
@ -298,7 +298,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
updateRepoWebhook := openapi3.Operation{}
updateRepoWebhook.WithTags("webhook")
updateRepoWebhook.WithMapOfAnything(map[string]interface{}{"operationId": "updateRepoWebhook"})
updateRepoWebhook.WithMapOfAnything(map[string]any{"operationId": "updateRepoWebhook"})
_ = reflector.SetRequest(&updateRepoWebhook, new(updateRepoWebhookRequest), http.MethodPatch)
_ = reflector.SetJSONResponse(&updateRepoWebhook, new(webhookType), http.StatusOK)
_ = reflector.SetJSONResponse(&updateRepoWebhook, new(usererror.Error), http.StatusBadRequest)
@ -309,7 +309,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
deleteRepoWebhook := openapi3.Operation{}
deleteRepoWebhook.WithTags("webhook")
deleteRepoWebhook.WithMapOfAnything(map[string]interface{}{"operationId": "deleteRepoWebhook"})
deleteRepoWebhook.WithMapOfAnything(map[string]any{"operationId": "deleteRepoWebhook"})
_ = reflector.SetRequest(&deleteRepoWebhook, new(deleteRepoWebhookRequest), http.MethodDelete)
_ = reflector.SetJSONResponse(&deleteRepoWebhook, nil, http.StatusNoContent)
_ = reflector.SetJSONResponse(&deleteRepoWebhook, new(usererror.Error), http.StatusBadRequest)
@ -322,7 +322,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
listRepoWebhookExecutions := openapi3.Operation{}
listRepoWebhookExecutions.WithTags("webhook")
listRepoWebhookExecutions.WithMapOfAnything(map[string]interface{}{"operationId": "listRepoWebhookExecutions"})
listRepoWebhookExecutions.WithMapOfAnything(map[string]any{"operationId": "listRepoWebhookExecutions"})
listRepoWebhookExecutions.WithParameters(QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&listRepoWebhookExecutions, new(listRepoWebhookExecutionsRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&listRepoWebhookExecutions, new([]types.WebhookExecution), http.StatusOK)
@ -335,7 +335,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
getRepoWebhookExecution := openapi3.Operation{}
getRepoWebhookExecution.WithTags("webhook")
getRepoWebhookExecution.WithMapOfAnything(map[string]interface{}{"operationId": "getRepoWebhookExecution"})
getRepoWebhookExecution.WithMapOfAnything(map[string]any{"operationId": "getRepoWebhookExecution"})
getRepoWebhookExecution.WithParameters(QueryParameterPage, QueryParameterLimit)
_ = reflector.SetRequest(&getRepoWebhookExecution, new(getRepoWebhookExecutionRequest), http.MethodGet)
_ = reflector.SetJSONResponse(&getRepoWebhookExecution, new(types.WebhookExecution), http.StatusOK)
@ -348,7 +348,7 @@ func webhookOperations(reflector *openapi3.Reflector) {
retriggerRepoWebhookExecution := openapi3.Operation{}
retriggerRepoWebhookExecution.WithTags("webhook")
retriggerRepoWebhookExecution.WithMapOfAnything(map[string]interface{}{"operationId": "retriggerRepoWebhookExecution"})
retriggerRepoWebhookExecution.WithMapOfAnything(map[string]any{"operationId": "retriggerRepoWebhookExecution"})
_ = reflector.SetRequest(&retriggerRepoWebhookExecution, new(repoWebhookExecutionRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&retriggerRepoWebhookExecution, new(types.WebhookExecution), http.StatusOK)
_ = reflector.SetJSONResponse(&retriggerRepoWebhookExecution, new(usererror.Error), http.StatusBadRequest)

View File

@ -23,7 +23,7 @@ import (
// RenderResource is a helper function that renders a single
// resource, wrapped in the harness payload envelope.
func RenderResource(w http.ResponseWriter, code int, v interface{}) {
func RenderResource(w http.ResponseWriter, code int, v any) {
payload := new(wrapper)
payload.Status = "SUCCESS"
payload.Data, _ = json.Marshal(v)

View File

@ -49,7 +49,7 @@ func DeleteSuccessful(w http.ResponseWriter) {
// JSON writes the json-encoded value to the response
// with the provides status.
func JSON(w http.ResponseWriter, code int, v interface{}) {
func JSON(w http.ResponseWriter, code int, v any) {
setCommonHeaders(w)
w.WriteHeader(code)
writeJSON(w, v)

View File

@ -44,7 +44,7 @@ func Forbidden(ctx context.Context, w http.ResponseWriter) {
}
// Forbiddenf writes the json-encoded message with a forbidden error.
func Forbiddenf(ctx context.Context, w http.ResponseWriter, format string, args ...interface{}) {
func Forbiddenf(ctx context.Context, w http.ResponseWriter, format string, args ...any) {
UserError(ctx, w, usererror.Newf(http.StatusForbidden, format, args...))
}
@ -54,7 +54,7 @@ func BadRequest(ctx context.Context, w http.ResponseWriter) {
}
// BadRequestf writes the json-encoded message with a bad request status code.
func BadRequestf(ctx context.Context, w http.ResponseWriter, format string, args ...interface{}) {
func BadRequestf(ctx context.Context, w http.ResponseWriter, format string, args ...any) {
UserError(ctx, w, usererror.Newf(http.StatusBadRequest, format, args...))
}
@ -64,7 +64,7 @@ func InternalError(ctx context.Context, w http.ResponseWriter) {
}
// InternalErrorf writes the json-encoded message with internal server error status code.
func InternalErrorf(ctx context.Context, w http.ResponseWriter, format string, args ...interface{}) {
func InternalErrorf(ctx context.Context, w http.ResponseWriter, format string, args ...any) {
UserError(ctx, w, usererror.Newf(http.StatusInternalServerError, format, args...))
}

View File

@ -16,6 +16,7 @@ package usererror
import (
"fmt"
"maps"
"net/http"
)
@ -129,9 +130,7 @@ func NewWithPayload(status int, message string, valueMaps ...map[string]any) *Er
values = valueMap
continue
}
for k, v := range valueMap {
values[k] = v
}
maps.Copy(values, valueMap)
}
return &Error{Status: status, Message: message, Values: values}
}

View File

@ -107,7 +107,7 @@ func (a *JWTAuthenticator) Authenticate(r *http.Request) (*auth.Session, error)
parsedToken, err := gojwt.ParseWithClaims(
str,
verifiedClaims,
func(_ *gojwt.Token) (interface{}, error) {
func(_ *gojwt.Token) (any, error) {
return []byte(salt), nil
},
)

View File

@ -71,7 +71,7 @@ func (g permissionCacheGetter) Find(ctx context.Context, key PermissionCacheKey)
// limit the depth to be safe (e.g. root/space1/space2 => maxDepth of 3)
maxDepth := len(paths.Segments(spaceRef))
for depth := 0; depth < maxDepth; depth++ {
for range maxDepth {
// Find the membership in the current space.
membership, err := g.membershipStore.Find(ctx, types.MembershipKey{
SpaceID: space.ID,

View File

@ -33,7 +33,7 @@ const (
type (
GitspaceInfraEventPayload struct {
Infra types.Infrastructure `json:"infra,omitempty"`
Infra types.Infrastructure `json:"infra,omitzero"`
Type enum.InfraEvent `json:"type"`
}
)

View File

@ -32,7 +32,7 @@ const (
type (
GitspaceOperationsEventPayload struct {
Type enum.GitspaceOperationsEvent `json:"type"`
Infra types.Infrastructure `json:"infra,omitempty"`
Infra types.Infrastructure `json:"infra,omitzero"`
Response any `json:"response,omitempty"`
}
)

View File

@ -115,7 +115,7 @@ func (c *RestClient) PostReceive(
}
// githook executes the requested githook type using the provided input.
func (c *RestClient) githook(ctx context.Context, githookType string, payload interface{}) (hook.Output, error) {
func (c *RestClient) githook(ctx context.Context, githookType string, payload any) (hook.Output, error) {
uri := c.baseURL + "/" + githookType
bodyBytes, err := json.Marshal(payload)
if err != nil {

View File

@ -359,5 +359,5 @@ func (i InfraProvisioner) useRoutingKey(
func (i InfraProvisioner) getRoutingKey(spacePath string, gitspaceConfigIdentifier string) string {
return uuid.NewSHA1(uuid.NameSpaceURL,
[]byte(fmt.Sprintf("%s%s", spacePath, gitspaceConfigIdentifier))).String()
fmt.Appendf(nil, "%s%s", spacePath, gitspaceConfigIdentifier)).String()
}

View File

@ -198,8 +198,8 @@ func ExtractLifecycleCommands(actionType PostAction, devcontainerConfig types.De
func AddIDECustomizationsArg(
ideService ide.IDE,
devcontainerConfig types.DevcontainerConfig,
args map[gitspaceTypes.IDEArg]interface{},
) map[gitspaceTypes.IDEArg]interface{} {
args map[gitspaceTypes.IDEArg]any,
) map[gitspaceTypes.IDEArg]any {
switch ideService.Type() {
case enum.IDETypeVSCodeWeb, enum.IDETypeVSCode, enum.IDETypeWindsurf, enum.IDETypeCursor:
// Cursor and Windsurf is a VSCode-based IDE, so it also uses the same customization
@ -222,8 +222,8 @@ func AddIDECustomizationsArg(
func AddIDEDownloadURLArg(
ideService ide.IDE,
args map[gitspaceTypes.IDEArg]interface{},
) map[gitspaceTypes.IDEArg]interface{} {
args map[gitspaceTypes.IDEArg]any,
) map[gitspaceTypes.IDEArg]any {
if !enum.IsJetBrainsIDE(ideService.Type()) {
// currently download url is only need for jetbrains IDEs
return args
@ -243,8 +243,8 @@ func AddIDEDownloadURLArg(
func AddIDEDirNameArg(
ideService ide.IDE,
args map[gitspaceTypes.IDEArg]interface{},
) map[gitspaceTypes.IDEArg]interface{} {
args map[gitspaceTypes.IDEArg]any,
) map[gitspaceTypes.IDEArg]any {
if !enum.IsJetBrainsIDE(ideService.Type()) {
// currently dirname is only need for jetbrains IDEs
return args

View File

@ -22,6 +22,7 @@ import (
"errors"
"fmt"
"io"
"maps"
"os/exec"
"path/filepath"
"strconv"
@ -608,9 +609,7 @@ func ExtractImageData(
return &imageData, fmt.Errorf("error while unmarshalling metadata: %w", err)
}
for _, values := range dst {
for k, v := range values {
metadataMap[k] = v
}
maps.Copy(metadataMap, values)
}
}
imageData.Metadata = metadataMap
@ -853,7 +852,7 @@ func processImagePullResponse(pullResponse io.ReadCloser, gitspaceLogger gitspac
layerStatus := make(map[string]string) // Track last status of each layer
for {
var pullEvent map[string]interface{}
var pullEvent map[string]any
if err := decoder.Decode(&pullEvent); err != nil {
if errors.Is(err, io.EOF) {
break

View File

@ -61,7 +61,7 @@ type step struct {
type LifecycleHookStep struct {
Source string `json:"source,omitempty"`
Command types.LifecycleCommand `json:"command,omitempty"`
Command types.LifecycleCommand `json:"command,omitzero"`
ActionType PostAction `json:"action_type,omitempty"`
StopOnFailure bool `json:"stop_on_failure,omitempty"`
}
@ -247,7 +247,7 @@ func (e *EmbeddedDockerOrchestrator) startStoppedGitspace(
}
// Run IDE setup
runIDEArgs := make(map[gitspaceTypes.IDEArg]interface{})
runIDEArgs := make(map[gitspaceTypes.IDEArg]any)
runIDEArgs[gitspaceTypes.IDERepoNameArg] = resolvedRepoDetails.RepoName
runIDEArgs = AddIDEDirNameArg(ideService, runIDEArgs)
if err = ideService.Run(ctx, exec, runIDEArgs, logStreamInstance); err != nil {
@ -694,7 +694,7 @@ func (e *EmbeddedDockerOrchestrator) buildSetupSteps(
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
// Run IDE setup
args := make(map[gitspaceTypes.IDEArg]interface{})
args := make(map[gitspaceTypes.IDEArg]any)
args = AddIDECustomizationsArg(ideService, resolvedRepoDetails.DevcontainerConfig, args)
args[gitspaceTypes.IDERepoNameArg] = resolvedRepoDetails.RepoName
args = AddIDEDownloadURLArg(ideService, args)
@ -711,7 +711,7 @@ func (e *EmbeddedDockerOrchestrator) buildSetupSteps(
exec *devcontainer.Exec,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
args := make(map[gitspaceTypes.IDEArg]interface{})
args := make(map[gitspaceTypes.IDEArg]any)
args[gitspaceTypes.IDERepoNameArg] = resolvedRepoDetails.RepoName
args = AddIDEDirNameArg(ideService, args)
return ideService.Run(ctx, exec, args, gitspaceLogger)

View File

@ -305,9 +305,9 @@ func (e *Exec) streamStdErr(stderr io.Reader, outputCh chan []byte, wg *sync.Wai
func handleOutputChannel(output []byte, verbose bool, gitspaceLogger types.GitspaceLogger) (bool, error) {
// Handle the exit status first
if strings.HasPrefix(string(output), ChannelExitStatus) {
if after, ok := strings.CutPrefix(string(output), ChannelExitStatus); ok {
// Extract the exit code from the message
exitCodeStr := strings.TrimPrefix(string(output), ChannelExitStatus)
exitCodeStr := after
exitCode, err := strconv.Atoi(exitCodeStr)
if err != nil {
return true, fmt.Errorf("invalid exit status format: %w", err)

View File

@ -22,7 +22,7 @@ import (
)
func getIDEDownloadURL(
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
) (types.IDEDownloadURLs, error) {
downloadURL, exists := args[gitspaceTypes.IDEDownloadURLArg]
if !exists {
@ -37,7 +37,7 @@ func getIDEDownloadURL(
return downloadURLs, nil
}
func getIDEDirName(args map[gitspaceTypes.IDEArg]interface{}) (string, error) {
func getIDEDirName(args map[gitspaceTypes.IDEArg]any) (string, error) {
dirName, exists := args[gitspaceTypes.IDEDIRNameArg]
if !exists {
return "", fmt.Errorf("ide dirname not found")
@ -52,7 +52,7 @@ func getIDEDirName(args map[gitspaceTypes.IDEArg]interface{}) (string, error) {
}
func getRepoName(
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
) (string, error) {
repoName, exists := args[gitspaceTypes.IDERepoNameArg]
if !exists {

View File

@ -50,7 +50,7 @@ func NewCursorService(config *CursorConfig) *Cursor {
func (c *Cursor) Setup(
ctx context.Context,
exec *devcontainer.Exec,
_ map[gitspaceTypes.IDEArg]interface{},
_ map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
gitspaceLogger.Info("Installing ssh-server inside container...")
@ -67,7 +67,7 @@ func (c *Cursor) Setup(
func (c *Cursor) Run(
ctx context.Context,
exec *devcontainer.Exec,
_ map[gitspaceTypes.IDEArg]interface{},
_ map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
gitspaceLogger.Info("Starting ssh-server...")

View File

@ -38,7 +38,7 @@ type IDE interface {
Setup(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error
@ -46,7 +46,7 @@ type IDE interface {
Run(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error

View File

@ -93,7 +93,7 @@ func (jb *JetBrainsIDE) port() int {
func (jb *JetBrainsIDE) Setup(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
gitspaceLogger.Info("Installing ssh-server inside container...")
@ -126,7 +126,7 @@ func (jb *JetBrainsIDE) Setup(
func (jb *JetBrainsIDE) setupJetbrainsIDE(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
payload := gitspaceTypes.SetupJetBrainsIDEPayload{
@ -170,7 +170,7 @@ func (jb *JetBrainsIDE) setupJetbrainsIDE(
func (jb *JetBrainsIDE) setupJetbrainsPlugins(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
payload := gitspaceTypes.SetupJetBrainsPluginPayload{
@ -223,7 +223,7 @@ func (jb *JetBrainsIDE) setupJetbrainsPlugins(
func (jb *JetBrainsIDE) Run(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
gitspaceLogger.Info("Running ssh-server...")
@ -245,7 +245,7 @@ func (jb *JetBrainsIDE) Run(
func (jb *JetBrainsIDE) runRemoteIDE(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
payload := gitspaceTypes.RunIntellijIDEPayload{

View File

@ -56,7 +56,7 @@ func NewVsCodeService(config *VSCodeConfig) *VSCode {
func (v *VSCode) Setup(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
gitspaceLogger.Info("Installing ssh-server inside container...")
@ -80,7 +80,7 @@ func (v *VSCode) Setup(
func (v *VSCode) setupVSCodeExtensions(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
payload := gitspaceTypes.SetupVSCodeExtensionsPayload{
@ -113,7 +113,7 @@ func (v *VSCode) setupVSCodeExtensions(
func (v *VSCode) Run(
ctx context.Context,
exec *devcontainer.Exec,
_ map[gitspaceTypes.IDEArg]interface{},
_ map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
gitspaceLogger.Info("Running ssh-server...")
@ -139,7 +139,7 @@ func (v *VSCode) Type() enum.IDEType {
}
func (v *VSCode) updateVSCodeSetupPayload(
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
payload *gitspaceTypes.SetupVSCodeExtensionsPayload,
) error {
@ -164,7 +164,7 @@ func (v *VSCode) updateVSCodeSetupPayload(
}
func (v *VSCode) handleVSCodeCustomization(
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
payload *gitspaceTypes.SetupVSCodeExtensionsPayload,
) error {

View File

@ -68,7 +68,7 @@ func NewVsCodeWebService(config *VSCodeWebConfig, urlScheme string) *VSCodeWeb {
func (v *VSCodeWeb) Setup(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
gitspaceLogger.Info("Installing VSCode Web inside container...")
@ -125,7 +125,7 @@ func (v *VSCodeWeb) updateMediaContent(ctx context.Context, exec *devcontainer.E
func (v *VSCodeWeb) Run(
ctx context.Context,
exec *devcontainer.Exec,
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
payload := gitspaceTypes.RunVSCodeWebPayload{
@ -160,7 +160,7 @@ func (v *VSCodeWeb) Run(
}
func updateSetupPayloadFromArgs(
args map[gitspaceTypes.IDEArg]interface{},
args map[gitspaceTypes.IDEArg]any,
payload *gitspaceTypes.SetupVSCodeWebPayload,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {

View File

@ -50,7 +50,7 @@ func NewWindsurfService(config *WindsurfConfig) *Windsurf {
func (w *Windsurf) Setup(
ctx context.Context,
exec *devcontainer.Exec,
_ map[gitspaceTypes.IDEArg]interface{},
_ map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
gitspaceLogger.Info("Installing ssh-server inside container...")
@ -67,7 +67,7 @@ func (w *Windsurf) Setup(
func (w *Windsurf) Run(
ctx context.Context,
exec *devcontainer.Exec,
_ map[gitspaceTypes.IDEArg]interface{},
_ map[gitspaceTypes.IDEArg]any,
gitspaceLogger gitspaceTypes.GitspaceLogger,
) error {
gitspaceLogger.Info("Starting ssh-server...")

View File

@ -64,7 +64,7 @@ func LoadTemplates() error {
return nil
}
func GenerateScriptFromTemplate(name string, data interface{}) (string, error) {
func GenerateScriptFromTemplate(name string, data any) (string, error) {
if scriptTemplates[name] == nil {
return "", fmt.Errorf("no script template found for %s", name)
}

View File

@ -73,7 +73,7 @@ func Concatenate(paths ...string) string {
}
sb := strings.Builder{}
for i := 0; i < len(paths); i++ {
for i := range paths {
// remove all leading, trailing, and consecutive '/'
var nextRune *rune
for _, r := range paths[i] {

View File

@ -54,66 +54,66 @@ func (w *wrapZerolog) WithError(err error) logger.Logger {
return &wrapZerolog{inner: w.inner, err: err}
}
func (w *wrapZerolog) WithField(key string, value interface{}) logger.Logger {
func (w *wrapZerolog) WithField(key string, value any) logger.Logger {
return &wrapZerolog{inner: w.inner.With().Str(key, fmt.Sprint(value)).Logger(), err: w.err}
}
func (w *wrapZerolog) Debug(args ...interface{}) {
func (w *wrapZerolog) Debug(args ...any) {
w.inner.Debug().Err(w.err).Msg(fmt.Sprint(args...))
}
func (w *wrapZerolog) Debugf(format string, args ...interface{}) {
func (w *wrapZerolog) Debugf(format string, args ...any) {
w.inner.Debug().Err(w.err).Msgf(format, args...)
}
func (w *wrapZerolog) Debugln(args ...interface{}) {
func (w *wrapZerolog) Debugln(args ...any) {
w.inner.Debug().Err(w.err).Msg(fmt.Sprintln(args...))
}
func (w *wrapZerolog) Error(args ...interface{}) {
func (w *wrapZerolog) Error(args ...any) {
w.inner.Error().Err(w.err).Msg(fmt.Sprint(args...))
}
func (w *wrapZerolog) Errorf(format string, args ...interface{}) {
func (w *wrapZerolog) Errorf(format string, args ...any) {
w.inner.Error().Err(w.err).Msgf(format, args...)
}
func (w *wrapZerolog) Errorln(args ...interface{}) {
func (w *wrapZerolog) Errorln(args ...any) {
w.inner.Error().Err(w.err).Msg(fmt.Sprintln(args...))
}
func (w *wrapZerolog) Info(args ...interface{}) {
func (w *wrapZerolog) Info(args ...any) {
w.inner.Info().Err(w.err).Msg(fmt.Sprint(args...))
}
func (w *wrapZerolog) Infof(format string, args ...interface{}) {
func (w *wrapZerolog) Infof(format string, args ...any) {
w.inner.Info().Err(w.err).Msgf(format, args...)
}
func (w *wrapZerolog) Infoln(args ...interface{}) {
func (w *wrapZerolog) Infoln(args ...any) {
w.inner.Info().Err(w.err).Msg(fmt.Sprintln(args...))
}
func (w *wrapZerolog) Trace(args ...interface{}) {
func (w *wrapZerolog) Trace(args ...any) {
w.inner.Trace().Err(w.err).Msg(fmt.Sprint(args...))
}
func (w *wrapZerolog) Tracef(format string, args ...interface{}) {
func (w *wrapZerolog) Tracef(format string, args ...any) {
w.inner.Trace().Err(w.err).Msgf(format, args...)
}
func (w *wrapZerolog) Traceln(args ...interface{}) {
func (w *wrapZerolog) Traceln(args ...any) {
w.inner.Trace().Err(w.err).Msg(fmt.Sprintln(args...))
}
func (w *wrapZerolog) Warn(args ...interface{}) {
func (w *wrapZerolog) Warn(args ...any) {
w.inner.Warn().Err(w.err).Msg(fmt.Sprint(args...))
}
func (w *wrapZerolog) Warnf(format string, args ...interface{}) {
func (w *wrapZerolog) Warnf(format string, args ...any) {
w.inner.Warn().Err(w.err).Msgf(format, args...)
}
func (w *wrapZerolog) Warnln(args ...interface{}) {
func (w *wrapZerolog) Warnln(args ...any) {
w.inner.Warn().Err(w.err).Msg(fmt.Sprintln(args...))
}

View File

@ -430,7 +430,7 @@ func parseV1Stages(
return nil, fmt.Errorf("could not check repo public access: %w", err)
}
inputParams := map[string]interface{}{}
inputParams := map[string]any{}
inputParams["repo"] = inputs.Repo(manager.ConvertToDroneRepo(repo, repoIsPublic))
inputParams["build"] = inputs.Build(manager.ConvertToDroneBuild(execution))

View File

@ -200,7 +200,7 @@ func addAuthHeader(req *http.Request, token string) {
req.Header.Add(headerAPIKey, token)
}
func unmarshalResponse(resp *http.Response, data interface{}) error {
func unmarshalResponse(resp *http.Response, data any) error {
if resp == nil {
return fmt.Errorf("http response is empty")
}

View File

@ -40,7 +40,7 @@ func (s *Service) handleGitspaceDeleteEvent(
err = s.gitspaceSvc.RemoveGitspace(ctx, *gitspaceConfig, true)
if err != nil {
// NOTE: No need to retry from the event handler. The background job will take care.
log.Debug().Err(err).Msgf("unable to delete gitspace: " + gitspaceConfigIdentifier)
log.Debug().Err(err).Msgf("unable to delete gitspace: %s", gitspaceConfigIdentifier)
}
log.Debug().Msgf("handled gitspace delete event with payload: %+v", event.Payload)

View File

@ -147,7 +147,7 @@ func (r *Repository) RunMany(
n := len(repoIDs)
defs := make([]job.Definition, n)
for k := 0; k < n; k++ {
for k := range n {
repoID := repoIDs[k]
cloneURL := cloneURLs[k]

View File

@ -75,7 +75,7 @@ type Event struct {
Category string `json:"category"`
Principal *types.PrincipalInfo `json:"user_id,omitempty"`
GroupID string `json:"group_id,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
Timestamp time.Time `json:"timestamp"`
Path string `json:"path"`
RemoteAddr string `json:"remote_addr"`
Properties map[Property]any `json:"properties,omitempty"`

View File

@ -165,7 +165,7 @@ func (s *Service) Save(
valuesToReturn[i] = newLabelValue(principalID, label.ID, &value.DefineValueInput)
if err = s.labelValueStore.Define(ctx, valuesToReturn[i]); err != nil {
if errors.Is(err, store.ErrDuplicate) {
return errors.Conflict("value %s already exists", valuesToReturn[i].Value)
return errors.Conflictf("value %s already exists", valuesToReturn[i].Value)
}
return err
}

View File

@ -474,7 +474,7 @@ func (s *Service) checkPullreqLabelInScope(
label *types.Label,
) error {
if label.RepoID != nil && *label.RepoID != repoID {
return errors.InvalidArgument("label %d is not defined in current repo", label.ID)
return errors.InvalidArgumentf("label %d is not defined in current repo", label.ID)
}
if label.SpaceID != nil {
@ -483,7 +483,7 @@ func (s *Service) checkPullreqLabelInScope(
return fmt.Errorf("failed to get parent space ids: %w", err)
}
if ok := slices.Contains(spaceIDs, *label.SpaceID); !ok {
return errors.InvalidArgument("label %d is not defined in current space tree path", label.ID)
return errors.InvalidArgumentf("label %d is not defined in current space tree path", label.ID)
}
}

View File

@ -227,10 +227,10 @@ type logger struct {
zerolog.Logger
}
func (l *logger) Logf(format string, args ...interface{}) {
func (l *logger) Logf(format string, args ...any) {
l.Info().Msgf(format, args...)
}
func (l *logger) Errorf(format string, args ...interface{}) {
func (l *logger) Errorf(format string, args ...any) {
l.Error().Msgf(format, args...)
}

View File

@ -154,7 +154,7 @@ func (migrate PullReq) Import(
extPullReq := &extPullReqData.PullRequest
if _, exists := pullReqUnique[extPullReq.Number]; exists {
return nil, errors.Conflict("duplicate pull request number %d", extPullReq.Number)
return nil, errors.Conflictf("duplicate pull request number %d", extPullReq.Number)
}
pullReqUnique[extPullReq.Number] = *extPullReqData
@ -510,7 +510,7 @@ func (r *repoImportState) createComment(
// a code comment must have a valid HunkHeader and must not be a reply
hunkHeader, ok := parser.ParseDiffHunkHeader(cc.HunkHeader)
if !ok {
return nil, errors.InvalidArgument("Invalid hunk header for code comment: %s", cc.HunkHeader)
return nil, errors.InvalidArgumentf("Invalid hunk header for code comment: %s", cc.HunkHeader)
}
comment.Kind = enum.PullReqActivityKindChangeComment

View File

@ -177,7 +177,7 @@ func GetSubjectPullRequest(
return fmt.Sprintf(subjectPullReqEvent, repoIdentifier, prTitle, prNum)
}
func GetHTMLBody(templateName string, data interface{}) ([]byte, error) {
func GetHTMLBody(templateName string, data any) ([]byte, error) {
tmpl := htmlTemplates[templateName]
tmplOutput := bytes.Buffer{}
err := tmpl.Execute(&tmplOutput, data)
@ -192,7 +192,7 @@ func GenerateEmailFromPayload(
templateName string,
recipients []*types.PrincipalInfo,
base *BasePullReqPayload,
payload interface{},
payload any,
) (*mailer.Payload, error) {
subject := GetSubjectPullRequest(base.Repo.Identifier, base.PullReq.Number,
base.PullReq.Title)

View File

@ -26,8 +26,8 @@ type RepoTargetFilter struct {
}
type RepoTarget struct {
Include RepoTargetFilter `json:"include,omitempty"`
Exclude RepoTargetFilter `json:"exclude,omitempty"`
Include RepoTargetFilter `json:"include"`
Exclude RepoTargetFilter `json:"exclude"`
}
func (p *RepoTarget) JSON() json.RawMessage {

View File

@ -14,7 +14,10 @@
package protection
import "errors"
import (
"errors"
"slices"
)
const maxElements = 100
@ -37,10 +40,8 @@ func validateIdentifierSlice(identifiers []string) error {
return errors.New("too many Identifiers provided")
}
for _, identifier := range identifiers {
if identifier == "" {
return errors.New("identifier mustn't be an empty string")
}
if slices.Contains(identifiers, "") {
return errors.New("identifier mustn't be an empty string")
}
return nil

View File

@ -64,7 +64,7 @@ type EntityMetadata struct {
func Parse(r io.Reader, principal *types.Principal) (KeyInfo, error) {
keyRing, err := openpgp.ReadArmoredKeyRing(r)
if err != nil {
return KeyInfo{}, errors.InvalidArgument("failed to read PGP key ring: %s", err.Error())
return KeyInfo{}, errors.InvalidArgumentf("failed to read PGP key ring: %s", err.Error())
}
if len(keyRing) == 0 {

View File

@ -38,19 +38,19 @@ func FromSSH(key gossh.PublicKey) KeyInfo {
func Parse(keyData []byte) (KeyInfo, error) {
publicKey, comment, _, _, err := gossh.ParseAuthorizedKey(keyData)
if err != nil {
return KeyInfo{}, errors.InvalidArgument("invalid SSH key data: %s" + err.Error())
return KeyInfo{}, errors.InvalidArgumentf("invalid SSH key data: %s", err.Error())
}
keyType := publicKey.Type()
// explicitly disallowed
if slices.Contains(DisallowedTypes, keyType) {
return KeyInfo{}, errors.InvalidArgument("keys of type %s are not allowed", keyType)
return KeyInfo{}, errors.InvalidArgumentf("keys of type %s are not allowed", keyType)
}
// only allowed
if !slices.Contains(AllowedTypes, keyType) {
return KeyInfo{}, errors.InvalidArgument("allowed key types are %v", AllowedTypes)
return KeyInfo{}, errors.InvalidArgumentf("allowed key types are %v", AllowedTypes)
}
return KeyInfo{

View File

@ -18,6 +18,7 @@ import (
"context"
"errors"
"fmt"
"slices"
"time"
gitevents "github.com/harness/gitness/app/events/git"
@ -157,11 +158,8 @@ func (s *Service) trigger(ctx context.Context, repoID int64,
validTriggers := []*types.Trigger{}
// Check which triggers are eligible to be fired
for _, t := range ret {
for _, a := range t.Actions {
if a == action {
validTriggers = append(validTriggers, t)
break
}
if slices.Contains(t.Actions, action) {
validTriggers = append(validTriggers, t)
}
}

View File

@ -33,7 +33,7 @@ func (s *Service) Find(
) (*types.Webhook, error) {
hook, err := s.GetWebhookVerifyOwnership(ctx, parentID, parentType, webhookIdentifier)
if err != nil {
return nil, errors.NotFound("failed to find webhook %s: %q", webhookIdentifier, err)
return nil, errors.NotFoundf("failed to find webhook %s: %q", webhookIdentifier, err)
}
return hook, nil
@ -66,7 +66,7 @@ func (s *Service) GetWebhookVerifyOwnership(
// ensure the webhook actually belongs to the repo
if webhook.ParentType != parentType || webhook.ParentID != parentID {
return nil, errors.NotFound("webhook doesn't belong to requested %s.", parentType)
return nil, errors.NotFoundf("webhook doesn't belong to requested %s.", parentType)
}
return webhook, nil

View File

@ -23,6 +23,7 @@ import (
"io"
"net"
"net/http"
"slices"
"time"
gitnessstore "github.com/harness/gitness/app/store"
@ -130,13 +131,7 @@ func (w *WebhookExecutor) triggerWebhooks(
}
// check if webhook is registered for trigger (empty list => all triggers are registered)
triggerRegistered := len(webhook.Triggers) == 0
for _, trigger := range webhook.Triggers {
if trigger == triggerType {
triggerRegistered = true
break
}
}
triggerRegistered := slices.Contains(webhook.Triggers, triggerType)
if !triggerRegistered {
continue
}
@ -426,10 +421,7 @@ func handleWebhookResponse(execution *types.WebhookExecutionCore, resp *http.Res
return tErr
}
// limit the total number of bytes we store in headers
headerLength := hBuff.Len()
if headerLength > responseHeadersBytesLimit {
headerLength = responseHeadersBytesLimit
}
headerLength := min(hBuff.Len(), responseHeadersBytesLimit)
execution.Response.Headers = string(hBuff.Bytes()[0:headerLength])
// handle body (if exists)

View File

@ -102,7 +102,7 @@ func migrateAfter_0039_alter_table_webhooks_uid(ctx context.Context, dbtx *sql.T
break
}
for i := 0; i < n; i++ {
for i := range n {
wh := buffer[i]
// concatenate repoID + spaceID to get unique parent id (only used to identify same parents)
@ -127,7 +127,7 @@ func migrateAfter_0039_alter_table_webhooks_uid(ctx context.Context, dbtx *sql.T
}
// try to generate unique id (adds random suffix if deterministic identifier derived from display name isn't unique)
for try := 0; try < 5; try++ {
for try := range 5 {
randomize := try > 0
newIdentifier, err := WebhookDisplayNameToIdentifier(wh.displayName, randomize)
if err != nil {

View File

@ -97,7 +97,7 @@ func migrateAfter_0042_alter_table_rules(
break
}
for i := 0; i < n; i++ {
for i := range n {
r := buffer[i]
log.Info().Msgf(

View File

@ -490,7 +490,7 @@ func mapToPublicKeys(
keys []publicKey,
) []types.PublicKey {
res := make([]types.PublicKey, len(keys))
for i := 0; i < len(keys); i++ {
for i := range keys {
res[i] = mapToPublicKey(&keys[i])
}
return res

View File

@ -546,7 +546,7 @@ func (s *RuleStore) mapToRules(
rules []rule,
) []types.Rule {
res := make([]types.Rule, len(rules))
for i := 0; i < len(rules); i++ {
for i := range rules {
res[i] = s.mapToRule(ctx, &rules[i])
}
return res
@ -592,7 +592,7 @@ func (s *RuleStore) mapToRuleInfos(
ruleInfos []ruleInfo,
) []types.RuleInfoInternal {
res := make([]types.RuleInfoInternal, len(ruleInfos))
for i := 0; i < len(ruleInfos); i++ {
for i := range ruleInfos {
res[i] = s.mapToRuleInfo(&ruleInfos[i])
}
return res

4
cache/ttl_cache.go vendored
View File

@ -17,7 +17,7 @@ package cache
import (
"context"
"fmt"
"sort"
"slices"
"sync"
"sync/atomic"
"time"
@ -230,7 +230,7 @@ func Deduplicate[V constraints.Ordered](slice []V) []V {
return slice
}
sort.Slice(slice, func(i, j int) bool { return slice[i] < slice[j] })
slices.Sort(slice)
pointer := 0
for i := 1; i < len(slice); i++ {

View File

@ -148,17 +148,17 @@ func (c *HTTPClient) UserDelete(ctx context.Context, key string) error {
//
// helper function for making an http GET request.
func (c *HTTPClient) get(ctx context.Context, rawurl string, out interface{}) error {
func (c *HTTPClient) get(ctx context.Context, rawurl string, out any) error {
return c.do(ctx, rawurl, "GET", false, nil, out)
}
// helper function for making an http POST request.
func (c *HTTPClient) post(ctx context.Context, rawurl string, noToken bool, in, out interface{}) error {
func (c *HTTPClient) post(ctx context.Context, rawurl string, noToken bool, in, out any) error {
return c.do(ctx, rawurl, "POST", noToken, in, out)
}
// helper function for making an http PATCH request.
func (c *HTTPClient) patch(ctx context.Context, rawurl string, in, out interface{}) error {
func (c *HTTPClient) patch(ctx context.Context, rawurl string, in, out any) error {
return c.do(ctx, rawurl, "PATCH", false, in, out)
}
@ -168,7 +168,7 @@ func (c *HTTPClient) delete(ctx context.Context, rawurl string) error {
}
// helper function to make an http request.
func (c *HTTPClient) do(ctx context.Context, rawurl, method string, noToken bool, in, out interface{}) error {
func (c *HTTPClient) do(ctx context.Context, rawurl, method string, noToken bool, in, out any) error {
// executes the http request and returns the body as
// and io.ReadCloser
body, err := c.stream(ctx, rawurl, method, noToken, in, out)
@ -191,7 +191,7 @@ func (c *HTTPClient) do(ctx context.Context, rawurl, method string, noToken bool
// helper function to stream a http request.
func (c *HTTPClient) stream(ctx context.Context, rawurl, method string, noToken bool,
in, _ interface{}) (io.ReadCloser, error) {
in, _ any) (io.ReadCloser, error) {
uri, err := url.Parse(rawurl)
if err != nil {
return nil, err

View File

@ -319,8 +319,7 @@ func BenchmarkGenerateHMACSHA256(b *testing.B) {
data := []byte("benchmark data")
key := []byte("benchmark key")
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
_, err := GenerateHMACSHA256(data, key)
if err != nil {
b.Fatal(err)
@ -332,8 +331,7 @@ func BenchmarkGenerateHMACSHA256LargeData(b *testing.B) {
data := []byte(strings.Repeat("a", 10000))
key := []byte("benchmark key")
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
_, err := GenerateHMACSHA256(data, key)
if err != nil {
b.Fatal(err)
@ -345,8 +343,7 @@ func BenchmarkIsShaEqual(b *testing.B) {
key1 := "benchmark string for comparison"
key2 := "benchmark string for comparison"
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
IsShaEqual(key1, key2)
}
}
@ -355,8 +352,7 @@ func BenchmarkIsShaEqualLarge(b *testing.B) {
key1 := strings.Repeat("a", 1000)
key2 := strings.Repeat("a", 1000)
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
IsShaEqual(key1, key2)
}
}

View File

@ -120,7 +120,7 @@ func AsError(err error) (e *Error) {
}
// Format is a helper function to return an Error with a given status and formatted message.
func Format(code Status, format string, args ...interface{}) *Error {
func Format(code Status, format string, args ...any) *Error {
msg := fmt.Sprintf(format, args...)
return &Error{
Status: code,
@ -129,51 +129,125 @@ func Format(code Status, format string, args ...interface{}) *Error {
}
// NotFound is a helper function to return an not found Error.
func NotFound(format string, args ...interface{}) *Error {
func NotFound(msg string) *Error {
return &Error{
Status: StatusNotFound,
Message: msg,
}
}
// NotFoundf is a helper function to return an not found Error.
func NotFoundf(format string, args ...any) *Error {
return Format(StatusNotFound, format, args...)
}
// InvalidArgument is a helper function to return an invalid argument Error.
func InvalidArgument(format string, args ...interface{}) *Error {
func InvalidArgument(msg string) *Error {
return &Error{
Status: StatusInvalidArgument,
Message: msg,
}
}
// InvalidArgumentf is a helper function to return an invalid argument Error.
func InvalidArgumentf(format string, args ...any) *Error {
return Format(StatusInvalidArgument, format, args...)
}
// Internal is a helper function to return an internal Error.
func Internal(err error, format string, args ...interface{}) *Error {
func Internal(err error, msg string) *Error {
return &Error{
Status: StatusInternal,
Message: msg,
Err: err,
}
}
// Internalf is a helper function to return an internal Error.
func Internalf(err error, format string, args ...any) *Error {
msg := fmt.Sprintf(format, args...)
return Format(StatusInternal, msg).SetErr(
return Format(StatusInternal, format, args...).SetErr(
fmt.Errorf("%s: %w", msg, err),
)
}
// Conflict is a helper function to return an conflict Error.
func Conflict(format string, args ...interface{}) *Error {
func Conflict(msg string) *Error {
return &Error{
Status: StatusConflict,
Message: msg,
}
}
// Conflictf is a helper function to return a conflict Error.
func Conflictf(format string, args ...any) *Error {
return Format(StatusConflict, format, args...)
}
// PreconditionFailed is a helper function to return an precondition
// PreconditionFailed is a helper function to return a precondition
// failed error.
func PreconditionFailed(format string, args ...interface{}) *Error {
func PreconditionFailed(msg string) *Error {
return &Error{
Status: StatusPreconditionFailed,
Message: msg,
}
}
// PreconditionFailedf is a helper function to return a precondition
// failed error.
func PreconditionFailedf(format string, args ...any) *Error {
return Format(StatusPreconditionFailed, format, args...)
}
// Unauthorized is a helper function to return an unauthorized error.
func Unauthorized(format string, args ...interface{}) *Error {
func Unauthorized(msg string) *Error {
return &Error{
Status: StatusUnauthorized,
Message: msg,
}
}
// Unauthorizedf is a helper function to return an unauthorized error.
func Unauthorizedf(format string, args ...any) *Error {
return Format(StatusUnauthorized, format, args...)
}
// Forbidden is a helper function to return a forbidden error.
func Forbidden(format string, args ...interface{}) *Error {
func Forbidden(msg string) *Error {
return &Error{
Status: StatusForbidden,
Message: msg,
}
}
// Forbiddenf is a helper function to return a forbidden error.
func Forbiddenf(format string, args ...any) *Error {
return Format(StatusForbidden, format, args...)
}
// Failed is a helper function to return failed error status.
func Failed(format string, args ...interface{}) *Error {
func Failed(msg string) *Error {
return &Error{
Status: StatusFailed,
Message: msg,
}
}
// Failedf is a helper function to return failed error status.
func Failedf(format string, args ...any) *Error {
return Format(StatusFailed, format, args...)
}
// Aborted is a helper function to return aborted error status.
func Aborted(format string, args ...interface{}) *Error {
func Aborted(msg string) *Error {
return &Error{
Status: StatusAborted,
Message: msg,
}
}
// Abortedf is a helper function to return aborted error status.
func Abortedf(format string, args ...any) *Error {
return Format(StatusAborted, format, args...)
}

View File

@ -303,7 +303,7 @@ func TestFormat(t *testing.T) {
name string
status Status
format string
args []interface{}
args []any
expected *Error
}{
{
@ -317,14 +317,14 @@ func TestFormat(t *testing.T) {
name: "format with args",
status: StatusInvalidArgument,
format: "invalid user ID: %d",
args: []interface{}{123},
args: []any{123},
expected: &Error{Status: StatusInvalidArgument, Message: "invalid user ID: 123"},
},
{
name: "format with multiple args",
status: StatusConflict,
format: "user %s already exists with email %s",
args: []interface{}{"john", "john@example.com"},
args: []any{"john", "john@example.com"},
expected: &Error{Status: StatusConflict, Message: "user john already exists with email john@example.com"},
},
}
@ -345,21 +345,21 @@ func TestFormat(t *testing.T) {
func TestHelperFunctions(t *testing.T) {
tests := []struct {
name string
fn func(string, ...interface{}) *Error
fn func(string, ...any) *Error
status Status
format string
args []interface{}
args []any
expected string
}{
{"NotFound", NotFound, StatusNotFound, "user %d not found", []interface{}{123}, "user 123 not found"},
{"InvalidArgument", InvalidArgument, StatusInvalidArgument,
"invalid email: %s", []interface{}{"invalid"}, "invalid email: invalid"},
{"Conflict", Conflict, StatusConflict, "user %s exists", []interface{}{"john"}, "user john exists"},
{"PreconditionFailed", PreconditionFailed, StatusPreconditionFailed, "version mismatch", nil, "version mismatch"},
{"Unauthorized", Unauthorized, StatusUnauthorized, "invalid token", nil, "invalid token"},
{"Forbidden", Forbidden, StatusForbidden, "access denied", nil, "access denied"},
{"Failed", Failed, StatusFailed, "operation failed", nil, "operation failed"},
{"Aborted", Aborted, StatusAborted, "operation aborted", nil, "operation aborted"},
{"NotFound", NotFoundf, StatusNotFound, "user %d not found", []any{123}, "user 123 not found"},
{"InvalidArgument", InvalidArgumentf, StatusInvalidArgument,
"invalid email: %s", []any{"invalid"}, "invalid email: invalid"},
{"Conflict", Conflictf, StatusConflict, "user %s exists", []any{"john"}, "user john exists"},
{"PreconditionFailed", PreconditionFailedf, StatusPreconditionFailed, "version mismatch", nil, "version mismatch"},
{"Unauthorized", Unauthorizedf, StatusUnauthorized, "invalid token", nil, "invalid token"},
{"Forbidden", Forbiddenf, StatusForbidden, "access denied", nil, "access denied"},
{"Failed", Failedf, StatusFailed, "operation failed", nil, "operation failed"},
{"Aborted", Abortedf, StatusAborted, "operation aborted", nil, "operation aborted"},
}
for _, tt := range tests {
@ -377,7 +377,7 @@ func TestHelperFunctions(t *testing.T) {
func TestInternal(t *testing.T) {
underlyingErr := errors.New("database connection failed")
result := Internal(underlyingErr, "failed to get user %d", 123)
result := Internalf(underlyingErr, "failed to get user %d", 123)
if result.Status != StatusInternal {
t.Errorf("Expected status %q, got %q", StatusInternal, result.Status)
@ -510,8 +510,7 @@ func BenchmarkErrorError(b *testing.B) {
Err: errors.New("underlying error"),
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
_ = err.Error()
}
}
@ -519,15 +518,13 @@ func BenchmarkErrorError(b *testing.B) {
func BenchmarkAsStatus(b *testing.B) {
err := &Error{Status: StatusNotFound, Message: "not found"}
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
AsStatus(err)
}
}
func BenchmarkFormat(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
_ = Format(StatusNotFound, "user %d not found", 123)
}
}
@ -535,8 +532,7 @@ func BenchmarkFormat(b *testing.B) {
func BenchmarkIsNotFound(b *testing.B) {
err := &Error{Status: StatusNotFound, Message: "not found"}
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
IsNotFound(err)
}
}

View File

@ -169,7 +169,7 @@ func TestAs(t *testing.T) {
tests := []struct {
name string
err error
target interface{}
target any
expected bool
}{
{
@ -244,7 +244,7 @@ func TestAsWithValues(t *testing.T) {
// Benchmark tests.
func BenchmarkNew(b *testing.B) {
for i := 0; i < b.N; i++ {
for b.Loop() {
_ = New("benchmark error")
}
}
@ -253,8 +253,7 @@ func BenchmarkIs(b *testing.B) {
err1 := New("error 1")
err2 := New("error 2")
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
Is(err1, err2)
}
}
@ -263,8 +262,7 @@ func BenchmarkAs(b *testing.B) {
err := customError{msg: "test"}
var target customError
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
As(err, &target)
}
}

View File

@ -183,32 +183,32 @@ func (e testValueError) Error() string { return "value receiver" }
// Benchmark tests.
func BenchmarkIsTypeValueError(b *testing.B) {
err := testValueError{}
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
IsType[testValueError](err)
}
}
func BenchmarkIsTypeCustomError(b *testing.B) {
err := customError{msg: "test"}
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
IsType[customError](err)
}
}
func BenchmarkIsTypeStandardError(b *testing.B) {
err := errors.New("standard error")
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
IsType[error](err)
}
}
func BenchmarkIsTypeWrappedError(b *testing.B) {
err := fmt.Errorf("wrapped: %w", testValueError{})
b.ResetTimer()
for i := 0; i < b.N; i++ {
for b.Loop() {
IsType[testValueError](err)
}
}

View File

@ -35,7 +35,7 @@ func NewDiscardEventError(inner error) error {
}
}
func NewDiscardEventErrorf(format string, args ...interface{}) error {
func NewDiscardEventErrorf(format string, args ...any) error {
return &discardEventError{
inner: fmt.Errorf(format, args...),
}

View File

@ -25,7 +25,7 @@ const (
streamPayloadKey = "event"
)
type Event[T interface{}] struct {
type Event[T any] struct {
ID string `json:"id"`
Timestamp time.Time `json:"timestamp"`
Payload T `json:"payload"`

View File

@ -143,7 +143,7 @@ type Reader interface {
Configure(opts ...ReaderOption)
}
type HandlerFunc[T interface{}] func(context.Context, *Event[T]) error
type HandlerFunc[T any] func(context.Context, *Event[T]) error
// GenericReader represents an event reader that supports registering type safe handlers
// for an arbitrary set of custom events within a given event category using the ReaderRegisterEvent method.
@ -157,13 +157,13 @@ type GenericReader struct {
// ReaderRegisterEvent registers a type safe handler function on the reader for a specific event.
// This method allows to register type safe handlers without the need of handling the raw stream payload.
// NOTE: Generic arguments are not allowed for struct methods, hence pass the reader as input parameter.
func ReaderRegisterEvent[T interface{}](reader *GenericReader,
func ReaderRegisterEvent[T any](reader *GenericReader,
eventType EventType, fn HandlerFunc[T], opts ...HandlerOption) error {
streamID := getStreamID(reader.category, eventType)
// register handler for event specific stream.
return reader.streamConsumer.Register(streamID,
func(ctx context.Context, messageID string, streamPayload map[string]interface{}) error {
func(ctx context.Context, messageID string, streamPayload map[string]any) error {
if streamPayload == nil {
return fmt.Errorf("stream payload is nil for message '%s'", messageID)
}

View File

@ -37,7 +37,7 @@ type GenericReporter struct {
// NOTE: This call is blocking until the event was send (not until it was processed).
//
//nolint:revive // emphasize that this is meant to be an operation on *GenericReporter
func ReporterSendEvent[T interface{}](reporter *GenericReporter, ctx context.Context,
func ReporterSendEvent[T any](reporter *GenericReporter, ctx context.Context,
eventType EventType, payload T) (string, error) {
streamID := getStreamID(reporter.category, eventType)
event := Event[T]{
@ -56,7 +56,7 @@ func ReporterSendEvent[T interface{}](reporter *GenericReporter, ctx context.Con
return "", fmt.Errorf("failed to encode payload: %w", err)
}
streamPayload := map[string]interface{}{
streamPayload := map[string]any{
streamPayloadKey: buff.Bytes(),
}

View File

@ -22,7 +22,7 @@ import (
// StreamProducer is an abstraction of a producer from the streams package.
type StreamProducer interface {
Send(ctx context.Context, streamID string, payload map[string]interface{}) (string, error)
Send(ctx context.Context, streamID string, payload map[string]any) (string, error)
}
// StreamConsumer is an abstraction of a consumer from the streams package.

View File

@ -52,7 +52,7 @@ func ParseArchiveFormat(format string) (ArchiveFormat, error) {
case "tgz":
return ArchiveFormatTgz, nil
default:
return "", errors.InvalidArgument("failed to parse file format '%s' is invalid", format)
return "", errors.InvalidArgumentf("failed to parse file format '%s' is invalid", format)
}
}
@ -61,7 +61,7 @@ func (f ArchiveFormat) Validate() error {
case ArchiveFormatTar, ArchiveFormatZip, ArchiveFormatTarGz, ArchiveFormatTgz:
return nil
default:
return errors.InvalidArgument("git archive flag format '%s' is invalid", f)
return errors.InvalidArgumentf("git archive flag format '%s' is invalid", f)
}
}
@ -174,7 +174,7 @@ func (g *Git) Archive(ctx context.Context, repoPath string, params ArchiveParams
case ArchiveFormatZip:
// zip accepts values digit 0-9
if *params.Compression < 0 || *params.Compression > 9 {
return errors.InvalidArgument("compression level argument '%d' not supported for format 'zip'",
return errors.InvalidArgumentf("compression level argument '%d' not supported for format 'zip'",
*params.Compression)
}
cmd.Add(command.WithArg(fmt.Sprintf("-%d", *params.Compression)))

View File

@ -230,7 +230,7 @@ func (r *BlameReader) NextPart() (*BlamePart, error) {
case blamePorcelainOutOfRangeErrorRE.MatchString(line):
return nil, errors.InvalidArgument(line)
default:
return nil, errors.Internal(nil, "failed to get next part: %s", line)
return nil, errors.Internalf(nil, "failed to get next part: %s", line)
}
}

View File

@ -61,7 +61,7 @@ func GetBlob(
}
if output.Type != GitObjectTypeBlob {
cancel()
return nil, errors.InvalidArgument(
return nil, errors.InvalidArgumentf(
"cat-file returned object type '%s' but expected '%s'", output.Type, GitObjectTypeBlob)
}

View File

@ -118,18 +118,18 @@ func ReadBatchHeaderLine(rd *bufio.Reader) (*BatchHeaderResponse, error) {
}
idx := strings.IndexByte(line, ' ')
if idx < 0 {
return nil, errors.NotFound("missing space char for: %s", line)
return nil, errors.NotFoundf("missing space char for: %s", line)
}
id := line[:idx]
objType := line[idx+1:]
if objType == "missing" {
return nil, errors.NotFound("sha '%s' not found", id)
return nil, errors.NotFoundf("sha '%s' not found", id)
}
idx = strings.IndexByte(objType, ' ')
if idx < 0 {
return nil, errors.NotFound("sha '%s' not found", id)
return nil, errors.NotFoundf("sha '%s' not found", id)
}
sizeStr := objType[idx+1 : len(objType)-1]

Some files were not shown because too many files have changed in this diff Show More