Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds warnings to jobmapping validator #3155

Merged
merged 14 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
nickzelei marked this conversation as resolved.
Show resolved Hide resolved
}

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;
nickzelei marked this conversation as resolved.
Show resolved Hide resolved
}

message VirtualForeignKey {
Expand Down
Loading
Loading