fix(serializer): required-field validation now respects sub-block visibility#1313
fix(serializer): required-field validation now respects sub-block visibility#1313icecrasher321 merged 1 commit intostagingfrom
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR fixes a critical validation bug in the File Block functionality where users were incorrectly getting "File URL is missing" errors even when they selected the "Upload Files" mode. The File Block supports two input methods: entering a file URL or uploading files directly. Previously, the validation logic was too simplistic and would always require the filePath parameter regardless of which input method the user selected.
The fix implements sophisticated conditional validation logic in the serializer (apps/sim/serializer/index.ts) that mirrors the UI's visibility behavior. The new validation system evaluates both sub-block mode visibility and conditional requirements before determining if a field should be validated as required. Specifically, it checks if inputMethod is set to 'url' before requiring the filePath parameter, ensuring that file upload mode doesn't trigger URL validation errors.
The implementation adds a complex condition evaluation system that handles nested conditions with 'and' clauses and supports both function and object-based conditions. This change aligns backend validation with frontend UI behavior, creating a consistent user experience where validation only occurs for fields that are actually visible and relevant to the current user's selections.
Confidence score: 4/5
- This PR addresses a clear UX bug with well-defined scope and proper conditional logic implementation
- Score reflects solid implementation with comprehensive condition handling, though the complex nested logic could benefit from additional testing
- Pay close attention to the condition evaluation logic in the serializer, particularly the nested
evalCondfunction and 'and' clause handling
1 file reviewed, no comments
* update infra and remove railway * overhaul docs * added a lot more videos/examples to docs * Revert "update infra and remove railway" This reverts commit b23258a. * remove unused lines * update start block docs * update agent docs * update API block docs * update function block docs * update response block docs * update parallel and router docs * update workflow docs * update connections docs * fix(sheets): fixed google sheets update (#1311) Google sheets append was sending an invalid shape to the google sheets api. This PR fixes this by having similar logic to what is in append.ts * fix(serializer): Required-field validation now respects sub-block visibility (#1313) * audit content * audit content --------- Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai> Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* update infra and remove railway * overhaul docs * added a lot more videos/examples to docs * Revert "update infra and remove railway" This reverts commit b23258a. * remove unused lines * update start block docs * update agent docs * update API block docs * update function block docs * update response block docs * update parallel and router docs * update workflow docs * update connections docs * fix(sheets): fixed google sheets update (#1311) Google sheets append was sending an invalid shape to the google sheets api. This PR fixes this by having similar logic to what is in append.ts * fix(serializer): Required-field validation now respects sub-block visibility (#1313) * audit content * audit content --------- Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai> Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
* update infra and remove railway * overhaul docs * added a lot more videos/examples to docs * Revert "update infra and remove railway" This reverts commit b23258a. * remove unused lines * update start block docs * update agent docs * update API block docs * update function block docs * update response block docs * update parallel and router docs * update workflow docs * update connections docs * fix(sheets): fixed google sheets update (simstudioai#1311) Google sheets append was sending an invalid shape to the google sheets api. This PR fixes this by having similar logic to what is in append.ts * fix(serializer): Required-field validation now respects sub-block visibility (simstudioai#1313) * audit content * audit content --------- Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai> Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Summary
Required-field validation now respects sub-block visibility (mode + conditions), so “File URL” is only required in URL mode and not in Upload Files.
Type of Change
Testing
Use File Block --> Upload Files should not throw "is missing File URL" error.
Checklist