You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
This PR adds a toggle switch to the function-tool-node-editor allowing users to switch between raw JSON editing and a visual JsonSchemaBuilder for input schemas. The implementation correctly follows the existing pattern established by the JsonSchemaInput component.
🟠🔶⚠️ Major (1) 🟠🔶⚠️
🟠 1) function-tool-node-editor.tsx:197-201Missing readOnly prop for JsonSchemaBuilder
Issue: The JsonSchemaBuilder component is not passed a readOnly prop, while the component supports this prop (see json-schema-builder.tsx:266). The existing JsonSchemaInput component passes readOnly to JsonSchemaBuilder (line 82 in json-schema-input.tsx). Without this, users who lack edit permissions (canEdit = false) can still modify the schema via the visual builder.
Why: This creates an inconsistent permission model. The component uses canEdit from useProjectPermissions() to conditionally hide the delete button (line 261), but this permission isn't enforced on the schema editors. While the StandaloneJsonEditor also doesn't receive a disabled/readOnly prop in this component, the visual builder with its interactive form controls is more obviously editable.
Fix: Pass readOnly={!canEdit} to the JsonSchemaBuilder:
No inline suggestions posted - the fix is straightforward but requires author confirmation on whether this is the intended behavior.
💡 APPROVE WITH SUGGESTIONS
Summary: This is a well-implemented feature that correctly follows existing patterns. The implementation is consistent with JsonSchemaInput and uses the shared global state appropriately. The one consideration is whether readOnly should be passed to enforce permissions - this may be intentional if the parent form already prevents saving, but worth confirming.
Other Findings (4)
Potentially valid
(these are minor or info and not confident enough to flag)
Location
Issue
Reason Excluded
function-tool-node-editor.tsx:171-173
Switch lacks explicit aria-label for accessibility
Follows existing pattern in JsonSchemaInput; label "JSON" is adjacent; Radix Switch is accessible by default
function-tool-node-editor.tsx:172
Label "JSON" could be clearer (e.g., "JSON Mode" or "Raw JSON")
Consistent with existing JsonSchemaInput; existing pattern is established
Discarded as invalid or not applicable
Location
Issue
Reason Excluded
Global state concern
Toggle affects all schema editors globally
Intentional design - user preference that persists; consistent with existing behavior
Data loss on mode switch
Switching modes could lose unsaved changes
Both editors use same underlying state (inputSchema string); changes sync properly via shared onChange handler
The reason will be displayed to describe this comment to others. Learn more.
Could we add a little bit of space (vertically) between the rows?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.