Skip to content

fix(serializer): required-field validation now respects sub-block visibility#1313

Merged
icecrasher321 merged 1 commit intostagingfrom
fix/sim-125
Sep 11, 2025
Merged

fix(serializer): required-field validation now respects sub-block visibility#1313
icecrasher321 merged 1 commit intostagingfrom
fix/sim-125

Conversation

@icecrasher321
Copy link
Collaborator

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

  • Bug fix

Testing

Use File Block --> Upload Files should not throw "is missing File URL" error.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Sep 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Sep 11, 2025 2:46am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 11, 2025 2:46am

@icecrasher321 icecrasher321 changed the title fix(serializer): Required-field validation now respects sub-block visibility fix(serializer): required-field validation now respects sub-block visibility Sep 11, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 evalCond function and 'and' clause handling

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@icecrasher321 icecrasher321 merged commit d3f7ef4 into staging Sep 11, 2025
6 checks passed
waleedlatif1 added a commit that referenced this pull request Sep 11, 2025
* 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>
Sg312 pushed a commit that referenced this pull request Sep 15, 2025
* 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>
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
* 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>
@waleedlatif1 waleedlatif1 deleted the fix/sim-125 branch November 6, 2025 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant