Skip to content

fix(workflow): handle 'number' DTO type in variable conversion#2672

Open
octo-patch wants to merge 1 commit intocoze-dev:mainfrom
octo-patch:fix/issue-2645-unknown-number-dto-type
Open

fix(workflow): handle 'number' DTO type in variable conversion#2672
octo-patch wants to merge 1 commit intocoze-dev:mainfrom
octo-patch:fix/issue-2645-unknown-number-dto-type

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #2645

Problem

When a plugin has output parameters with nested array<number> type (e.g., array<object>[i].array<number>), adding the plugin to a workflow throws:

Unknown variable DTO Type: list:number

The backend's DataTypeNumber (float64) is serialized as "number" in the API response, but VariableTypeDTO in @coze-workflow/base only defines float and integer for numeric types — "number" is unrecognized and falls through to the error branch in DTOTypeToViewType.

Solution

  • Add number = 'number' to the VariableTypeDTO enum in dto.ts
  • In DTOTypeToViewType, treat VariableTypeDTO.number the same as float (both map to ViewVariableType.Number / ViewVariableType.ArrayNumber)
  • Add VariableTypeDTO.number entry to the JSON Schema props map in generate-input-json-schema.ts

Testing

The fix is minimal and localized to the DTO→view-type conversion layer. The number type is now treated identically to float, which matches the backend semantics (both represent float64).

…oze-dev#2645)

The backend can return 'number' as a DataType (DataTypeNumber = float64) for
plugin output parameters, but the frontend VariableTypeDTO enum in
@coze-workflow/base only defined 'float' and 'integer'. This caused
DTOTypeToViewType to throw "Unknown variable DTO Type: list:number" when adding
a plugin with nested array<number> output parameters to a workflow.

- Add `number = 'number'` to VariableTypeDTO enum in dto.ts
- Handle VariableTypeDTO.number (fall-through to float) in DTOTypeToViewType
- Add VariableTypeDTO.number entry to VariableType2JsonSchemaProps map

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
@octo-patch octo-patch requested a review from zxhfighter as a code owner April 24, 2026 02:01
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.

工作流增加插件失败,报错:Unknow variable DTO:list:number

1 participant