Remove plugin data query projection
This commit is contained in:
@@ -572,32 +572,8 @@ func validateGameClientBridgeManifest(field string, bridge domain.GameClientBrid
|
||||
if template.PollIntervalSeconds < 0 || template.PollIntervalSeconds > 86400 {
|
||||
violations = append(violations, prefix+".pollIntervalSeconds is invalid")
|
||||
}
|
||||
projectsRows := template.SQLRef != "" || template.RowTarget != nil
|
||||
if projectsRows {
|
||||
if !safeRelativeSQLRef(template.SQLRef) {
|
||||
violations = append(violations, prefix+".sqlRef must reference a package-relative SQL asset")
|
||||
}
|
||||
if template.RowTarget == nil {
|
||||
violations = append(violations, prefix+".rowTarget is required for projected queries")
|
||||
} else {
|
||||
target := template.RowTarget
|
||||
if !clientManagerIdentifierPattern.MatchString(target.Collection) || len(target.UpsertKeys) == 0 || len(target.ColumnMappings) == 0 {
|
||||
violations = append(violations, prefix+".rowTarget must declare a collection, upsert keys, and column mappings")
|
||||
}
|
||||
if target.WriteMode != "" && target.WriteMode != domain.PluginDataRowWriteModeMerge && target.WriteMode != domain.PluginDataRowWriteModeReplace {
|
||||
violations = append(violations, prefix+".rowTarget.writeMode must be merge or replace")
|
||||
}
|
||||
for _, key := range target.UpsertKeys {
|
||||
if !clientManagerIdentifierPattern.MatchString(key) {
|
||||
violations = append(violations, prefix+".rowTarget upsert key is invalid")
|
||||
}
|
||||
}
|
||||
for destination, source := range target.ColumnMappings {
|
||||
if !clientManagerIdentifierPattern.MatchString(destination) || !clientManagerIdentifierPattern.MatchString(source) {
|
||||
violations = append(violations, prefix+".rowTarget column mapping is invalid")
|
||||
}
|
||||
}
|
||||
}
|
||||
if template.SQLRef != "" && !safeRelativeSQLRef(template.SQLRef) {
|
||||
violations = append(violations, prefix+".sqlRef must reference a package-relative SQL asset")
|
||||
}
|
||||
transport, exists := transports[template.TransportKey]
|
||||
if !exists {
|
||||
|
||||
@@ -201,9 +201,8 @@ func TestValidateGamePluginManifestRegistrationValidatesGameClientBridgeCatalog(
|
||||
{name: "poll interval bound", expected: "pollIntervalSeconds is invalid", mutate: func(value *domain.GamePluginManifestRegistration) {
|
||||
value.Manifest.GameClientBridge.QueryTemplates[0].PollIntervalSeconds = 86401
|
||||
}},
|
||||
{name: "write mode", expected: "writeMode must be merge or replace", mutate: func(value *domain.GamePluginManifestRegistration) {
|
||||
value.Manifest.GameClientBridge.QueryTemplates[0].SQLRef = "sql/player-lookup.sql"
|
||||
value.Manifest.GameClientBridge.QueryTemplates[0].RowTarget = &domain.PluginDataRowTargetDeclaration{Collection: "users", UpsertKeys: []string{"userId"}, ColumnMappings: map[string]string{"userId": "user_id"}, WriteMode: "append"}
|
||||
{name: "unsafe SQL asset", expected: "sqlRef must reference", mutate: func(value *domain.GamePluginManifestRegistration) {
|
||||
value.Manifest.GameClientBridge.QueryTemplates[0].SQLRef = "/etc/player-lookup.sql"
|
||||
}},
|
||||
{name: "unknown transport", expected: "transportKey must reference", mutate: func(value *domain.GamePluginManifestRegistration) {
|
||||
value.Manifest.GameClientBridge.QueryTemplates[0].TransportKey = "missing"
|
||||
|
||||
Reference in New Issue
Block a user