Skip to content

Commit c4fac95

Browse files
committed
updates to register both v1 and v2 files
1 parent 129530e commit c4fac95

File tree

1 file changed

+5
-1
lines changed
  • framework/components/dockercompose/chip_ingress_set

1 file changed

+5
-1
lines changed

framework/components/dockercompose/chip_ingress_set/protos.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,8 @@ func registerAllWithTopologicalSorting(
501501
for _, dep := range deps {
502502
if depSubject, depExists := subjectMap[dep]; depExists {
503503
// The schema registry expects import names without the 'workflows/' prefix
504+
// So if the import is "workflows/v1/metadata.proto", the name should be "v1/metadata.proto"
505+
// And if the import is "workflows/v2/cre_info.proto", the name should be "v2/cre_info.proto"
504506
importName := dep
505507
if strings.HasPrefix(dep, "workflows/") {
506508
importName = strings.TrimPrefix(dep, "workflows/")
@@ -524,7 +526,9 @@ func registerAllWithTopologicalSorting(
524526
}
525527

526528
// The schema registry expects import statements without the 'workflows/' prefix
527-
modifiedSchema := strings.ReplaceAll(schema.Source, `"workflows/v2/`, `"v2/`)
529+
// So we need to modify the protobuf content to replace "workflows/v1/..." with "v1/..." and "workflows/v2/..." with "v2/..."
530+
modifiedSchema := strings.ReplaceAll(schema.Source, `"workflows/v1/`, `"v1/`)
531+
modifiedSchema = strings.ReplaceAll(modifiedSchema, `"workflows/v2/`, `"v2/`)
528532

529533
_, registerErr := registerSingleProto(schemaRegistryURL, subject, modifiedSchema, fileRefs)
530534
if registerErr != nil {

0 commit comments

Comments
 (0)