Skip to content

Commit

Permalink
Adds warnings to jobmapping validator (#3155)
Browse files Browse the repository at this point in the history
  • Loading branch information
alishakawaguchi authored Jan 17, 2025
1 parent 0f57e26 commit 8b6ea3e
Show file tree
Hide file tree
Showing 25 changed files with 3,381 additions and 1,622 deletions.
1,796 changes: 954 additions & 842 deletions backend/gen/go/protos/mgmt/v1alpha1/job.pb.go

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions backend/gen/go/protos/mgmt/v1alpha1/job.pb.json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions backend/internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package utils

import (
"net/http"
"slices"
"strings"

nucleuserrors "github.com/nucleuscloud/neosync/backend/internal/errors"
Expand Down Expand Up @@ -53,30 +52,6 @@ func NoElementEqual[T comparable](slice []T, value T) bool {
return true
}

func CompareSlices(slice1, slice2 []string) bool {
if len(slice1) != len(slice2) {
return false
}
for _, ele := range slice1 {
if !slices.Contains(slice2, ele) {
return false
}
}
return true
}

func DedupeSlice[T comparable](input []T) []T {
set := map[T]any{}
for _, i := range input {
set[i] = struct{}{}
}
output := make([]T, 0, len(set))
for key := range set {
output = append(output, key)
}
return output
}

func GetBearerTokenFromHeader(
header http.Header,
key string,
Expand Down
15 changes: 15 additions & 0 deletions backend/protos/mgmt/v1alpha1/job.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,8 @@ message ValidateJobMappingsRequest {
string connection_id = 3 [(buf.validate.field).string.uuid = true];
// The list of virtual foreign keys
repeated VirtualForeignConstraint virtual_foreign_keys = 4;
// The source options of the job
optional JobSource job_source = 5;
}

message ColumnError {
Expand All @@ -1085,6 +1087,17 @@ message ColumnError {
repeated string errors = 4;
}

message ColumnWarning {
// The schema of the table
string schema = 1;
// The table of the column
string table = 2;
// The column of the warning
string column = 3;
// The list of warnings
repeated string warnings = 5;
}

message DatabaseError {
// The list of errors
repeated string errors = 1;
Expand All @@ -1094,6 +1107,8 @@ message ValidateJobMappingsResponse {
repeated ColumnError column_errors = 1;
// The database error
DatabaseError database_errors = 2;
// The list of column warnings
repeated ColumnWarning column_warnings = 3;
}

message VirtualForeignKey {
Expand Down
Loading

0 comments on commit 8b6ea3e

Please sign in to comment.