Skip to content

Conversation

@asukaminato0721
Copy link
Contributor

…e input field.

The toolCredentialToFormSchemas function in web/app/components/tools/utils/to-form-schema.ts was not correctly mapping the type property for tool credentials. This resulted in boolean fields not being rendered as checkboxes in the plugin's endpoint form.

This commit adds the type mapping to the function, ensuring that all form fields, including booleans, are rendered correctly.

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

try #26344

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@asukaminato0721
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses an issue where boolean fields in the plugin's endpoint form were not rendering as checkboxes. The fix involves mapping the tool credential type to the correct form schema type, which is a good and necessary change. I've added one suggestion to improve consistency with a similar function in the codebase, which will enhance maintainability.

...parameter,
variable: parameter.name,
label: parameter.label,
type: toType(parameter.type),
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with the toolParametersToFormSchemas function, it would be beneficial to also store the original type in a _type property. This makes this function's behavior consistent with other utility functions in the codebase and could prevent potential issues if downstream logic needs to differentiate between the original data type (e.g., 'boolean') and the form component type (e.g., 'checkbox').

Suggested change
type: toType(parameter.type),
type: toType(parameter.type),
_type: parameter.type,

@asukaminato0721 asukaminato0721 force-pushed the fix-missing-plugin-form-input branch from 67e8655 to 3c0f166 Compare September 30, 2025 02:53
…e input field.

The `toolCredentialToFormSchemas` function in `web/app/components/tools/utils/to-form-schema.ts` was not correctly mapping the `type` property for tool credentials. This resulted in boolean fields not being rendered as checkboxes in the plugin's endpoint form.

This commit adds the type mapping to the function, ensuring that all form fields, including booleans, are rendered correctly.
@asukaminato0721 asukaminato0721 force-pushed the fix-missing-plugin-form-input branch from 3c0f166 to 01842d0 Compare September 30, 2025 07:40
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