From cbd892aa8a42892ee461db5ee8263a8649687ed2 Mon Sep 17 00:00:00 2001 From: Mishael-2584 Date: Wed, 21 Jan 2026 14:31:13 +0300 Subject: [PATCH] fix: handle root-level forms/ext.json in bundle validation - Fix validation to properly handle forms/ext.json (root-level ext.json) - Previously only handled forms/{formName}/ext.json (form-level) - Updated all 4 locations where ext.json files are checked: 1. Form directory tracking (skip forms/ext.json) 2. Form file validation (skip forms/ext.json) 3. Extension renderer collection (include forms/ext.json) 4. Extension validation (include forms/ext.json) Fixes validation error: 'invalid form file path: forms/ext.json' --- synkronus-cli/pkg/validation/bundle.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/synkronus-cli/pkg/validation/bundle.go b/synkronus-cli/pkg/validation/bundle.go index 22ebdf07e..cf555472a 100644 --- a/synkronus-cli/pkg/validation/bundle.go +++ b/synkronus-cli/pkg/validation/bundle.go @@ -58,7 +58,8 @@ func ValidateBundle(bundlePath string) error { // Track form directories (exclude ext.json files) if strings.HasPrefix(file.Name, "forms/") && !strings.HasSuffix(file.Name, "/") { // Skip ext.json files - they're not form directories - if strings.HasSuffix(file.Name, "/ext.json") { + // Skip both root-level (forms/ext.json) and form-level (forms/{formName}/ext.json) + if file.Name == "forms/ext.json" || strings.HasSuffix(file.Name, "/ext.json") { continue } formParts := strings.Split(file.Name, "/") @@ -81,7 +82,8 @@ func ValidateBundle(bundlePath string) error { // Validate form structure if strings.HasPrefix(file.Name, "forms/") { // Skip ext.json files - they're validated separately in validateExtensions - if strings.HasSuffix(file.Name, "/ext.json") { + // Skip both root-level (forms/ext.json) and form-level (forms/{formName}/ext.json) + if file.Name == "forms/ext.json" || strings.HasSuffix(file.Name, "/ext.json") { continue } if err := validateFormFile(file); err != nil { @@ -180,7 +182,8 @@ func validateFormRendererReferences(zipReader *zip.Reader) error { // Second, collect extension renderers from ext.json files for _, file := range zipReader.File { - if strings.HasSuffix(file.Name, "/ext.json") { + // Collect both root-level (forms/ext.json) and form-level (forms/{formName}/ext.json) ext.json files + if file.Name == "forms/ext.json" || strings.HasSuffix(file.Name, "/ext.json") { rc, err := file.Open() if err != nil { continue // Skip if can't open @@ -413,7 +416,8 @@ func validateExtensions(zipReader *zip.Reader) error { // First pass: collect extension files and validate structure for _, file := range zipReader.File { - if strings.HasSuffix(file.Name, "/ext.json") { + // Collect both root-level (forms/ext.json) and form-level (forms/{formName}/ext.json) ext.json files + if file.Name == "forms/ext.json" || strings.HasSuffix(file.Name, "/ext.json") { extensionFiles[file.Name] = file // Validate JSON structure