fix(workflow): handle 'number' DTO type in variable conversion#2672
Open
octo-patch wants to merge 1 commit intocoze-dev:mainfrom
Open
fix(workflow): handle 'number' DTO type in variable conversion#2672octo-patch wants to merge 1 commit intocoze-dev:mainfrom
octo-patch wants to merge 1 commit intocoze-dev:mainfrom
Conversation
…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>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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:The backend's
DataTypeNumber(float64) is serialized as"number"in the API response, butVariableTypeDTOin@coze-workflow/baseonly definesfloatandintegerfor numeric types —"number"is unrecognized and falls through to the error branch inDTOTypeToViewType.Solution
number = 'number'to theVariableTypeDTOenum indto.tsDTOTypeToViewType, treatVariableTypeDTO.numberthe same asfloat(both map toViewVariableType.Number/ViewVariableType.ArrayNumber)VariableTypeDTO.numberentry to the JSON Schema props map ingenerate-input-json-schema.tsTesting
The fix is minimal and localized to the DTO→view-type conversion layer. The
numbertype is now treated identically tofloat, which matches the backend semantics (both represent float64).