Skip to content

fix(web): change http body key name#888

Merged
shuqinzhao merged 1 commit intorelease/v0.3.0from
fix/v0.3.0_zy
Apr 14, 2026
Merged

fix(web): change http body key name#888
shuqinzhao merged 1 commit intorelease/v0.3.0from
fix/v0.3.0_zy

Conversation

@shuqinzhao
Copy link
Copy Markdown
Collaborator

@shuqinzhao shuqinzhao commented Apr 14, 2026

Summary by Sourcery

使 HTTP 请求配置处理方式与更新后的请求条目键名保持一致。

Bug Fixes:

  • 将 HTTP 请求可编辑表格中的请求体字段从使用 name 改为使用 key
  • 修正 HTTP 头和参数在序列化与反序列化时的逻辑,在 UI 行与工作流配置之间映射时改为使用 key 属性。
Original summary in English

Summary by Sourcery

Align HTTP request configuration handling with updated key naming for request entries.

Bug Fixes:

  • Update HTTP request editable table to use 'key' instead of 'name' for request body fields.
  • Correct serialization and deserialization of HTTP headers and params to use the 'key' property when mapping between UI rows and workflow config.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Apr 14, 2026

审阅者指南(在小型 PR 上折叠)

审阅者指南

在可编辑表格 UI 和工作流图配置转换逻辑中,将 HTTP 请求 body 字段标识符从 name 重命名为 key,以确保在配置对象与数组之间互相转换时,HTTP headers/params 项的结构保持一致。

HTTP Header 键/值编辑流程的时序图

sequenceDiagram
  actor User
  participant EditableTable
  participant Form
  participant useWorkflowGraph
  participant WorkflowConfig

  User->>EditableTable: Edit HTTP header key and value
  EditableTable->>Form: Bind inputs to fields [index, key] and [index, value]
  User->>Form: Submit HTTP request node configuration
  Form->>useWorkflowGraph: Submit config with headers as array of { key, value }
  useWorkflowGraph->>WorkflowConfig: Transform array to object using vo.key as property name
  WorkflowConfig-->>useWorkflowGraph: Persisted config.headers as object { key: value }
  useWorkflowGraph-->>EditableTable: When loading, map Object.entries(headers) to array of { key, value }
  EditableTable-->>User: Display header rows with key and value columns
Loading

HTTP Header 项与配置转换的类图

classDiagram
  class HeaderItem {
    +string key
    +string value
  }

  class HttpRequestConfigObject {
    +Record~string,string~ headers
    +Record~string,string~ params
  }

  class HttpRequestConfigArray {
    +HeaderItem[] headers
    +HeaderItem[] params
  }

  class NodeLibraryConfigEntry {
    +any defaultValue
  }

  class NodeLibraryConfig {
    +NodeLibraryConfigEntry headers
    +NodeLibraryConfigEntry params
  }

  class UseWorkflowGraph {
    +toArrayConfig(configObject HttpRequestConfigObject) HttpRequestConfigArray
    +toObjectConfig(configArray HttpRequestConfigArray) HttpRequestConfigObject
  }

  UseWorkflowGraph --> HttpRequestConfigObject : reads and writes
  UseWorkflowGraph --> HttpRequestConfigArray : reads and writes
  NodeLibraryConfigEntry o-- HttpRequestConfigArray : defaultValue uses HeaderItem[]
  HttpRequestConfigArray "1" o-- "*" HeaderItem : contains
  HttpRequestConfigObject ..> HeaderItem : keys correspond to HeaderItem.key values
Loading

文件级变更

Change Details Files
通过将 body 项标识符从 name 重命名为 key,使 HTTP 请求键/值编辑 UI 与底层配置结构保持一致。
  • 更新可编辑 HTTP 请求表格列,将名称列的 dataIndex 改为使用 key
  • 将对应的 Form.Item 字段名路径从 name 改为 key,从而使表单值以 key 序列化。
  • 调整工作流图初始化逻辑,将 HTTP headers/params 对象映射为 { name, value } 数组改为 { key, value } 数组。
  • 更新工作流图序列化逻辑,在重建配置时使用 vo.key 而不是 vo.name 来构建 headers/params 对象。
web/src/views/Workflow/components/Properties/HttpRequest/EditableTable.tsx
web/src/views/Workflow/hooks/useWorkflowGraph.ts

提示与命令

与 Sourcery 交互

  • 触发新的审阅: 在 pull request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub issue: 通过回复某条审阅评论,让 Sourcery 从该评论创建一个 issue。你也可以回复该审阅评论 @sourcery-ai issue 来从中创建 issue。
  • 生成 pull request 标题: 在 pull request 标题中任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在 pull request 上评论 @sourcery-ai title 来随时(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文中任意位置写入 @sourcery-ai summary,即可在你希望的位置随时生成 PR 摘要。你也可以在 pull request 上评论 @sourcery-ai summary 来随时(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 上评论 @sourcery-ai guide,即可随时(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在 pull request 上评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 驳回所有 Sourcery 审阅: 在 pull request 上评论 @sourcery-ai dismiss,即可驳回所有现有的 Sourcery 审阅。如果你想从一个新的审阅开始,这尤其有用——别忘了再评论 @sourcery-ai review 来触发新的审阅!

自定义你的体验

访问你的 控制面板 以:

  • 启用或禁用诸如 Sourcery 生成的 pull request 摘要、审阅者指南等审阅功能。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅指令。
  • 调整其他审阅设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Renames the HTTP request body field identifier from name to key across the editable table UI and the workflow graph config transformation logic, ensuring consistent shape for HTTP headers/params items when converting between config objects and arrays.

Sequence diagram for HTTP header key/value editing flow

sequenceDiagram
  actor User
  participant EditableTable
  participant Form
  participant useWorkflowGraph
  participant WorkflowConfig

  User->>EditableTable: Edit HTTP header key and value
  EditableTable->>Form: Bind inputs to fields [index, key] and [index, value]
  User->>Form: Submit HTTP request node configuration
  Form->>useWorkflowGraph: Submit config with headers as array of { key, value }
  useWorkflowGraph->>WorkflowConfig: Transform array to object using vo.key as property name
  WorkflowConfig-->>useWorkflowGraph: Persisted config.headers as object { key: value }
  useWorkflowGraph-->>EditableTable: When loading, map Object.entries(headers) to array of { key, value }
  EditableTable-->>User: Display header rows with key and value columns
Loading

Class diagram for HTTP header item and config transformation

classDiagram
  class HeaderItem {
    +string key
    +string value
  }

  class HttpRequestConfigObject {
    +Record~string,string~ headers
    +Record~string,string~ params
  }

  class HttpRequestConfigArray {
    +HeaderItem[] headers
    +HeaderItem[] params
  }

  class NodeLibraryConfigEntry {
    +any defaultValue
  }

  class NodeLibraryConfig {
    +NodeLibraryConfigEntry headers
    +NodeLibraryConfigEntry params
  }

  class UseWorkflowGraph {
    +toArrayConfig(configObject HttpRequestConfigObject) HttpRequestConfigArray
    +toObjectConfig(configArray HttpRequestConfigArray) HttpRequestConfigObject
  }

  UseWorkflowGraph --> HttpRequestConfigObject : reads and writes
  UseWorkflowGraph --> HttpRequestConfigArray : reads and writes
  NodeLibraryConfigEntry o-- HttpRequestConfigArray : defaultValue uses HeaderItem[]
  HttpRequestConfigArray "1" o-- "*" HeaderItem : contains
  HttpRequestConfigObject ..> HeaderItem : keys correspond to HeaderItem.key values
Loading

File-Level Changes

Change Details Files
Align HTTP request key/value editing UI with underlying config shape by renaming the body item identifier from name to key.
  • Update editable HTTP request table column to use key as the dataIndex for the name column.
  • Change the corresponding Form.Item field name path from name to key so form values serialize with key.
  • Adjust workflow graph initialization to map HTTP headers/params objects to arrays of { key, value } instead of { name, value }.
  • Update workflow graph serialization to build headers/params objects using vo.key instead of vo.name when reconstructing config.
web/src/views/Workflow/components/Properties/HttpRequest/EditableTable.tsx
web/src/views/Workflow/hooks/useWorkflowGraph.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@shuqinzhao shuqinzhao merged commit bcadd2a into release/v0.3.0 Apr 14, 2026
1 check passed
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - 我在这里给出了一些高层次的反馈:

  • useWorkflowGraph 中,headers/params 分支里的 map(([key, value]) => ({ key, value })) 会遮蔽外层作用域中的 key 变量,这可能会让人困惑;建议重命名内部解构出来的 key(例如改为 [entryKey, value])。
  • 在构建 itemConfig[key] 时访问 vo.keyvo.value 的地方,建议为这些表格行定义并使用一个带类型的接口,而不是使用 any,以保证新 key 属性的使用是类型安全的。
给 AI Agent 的提示
Please address the comments from this code review:

## Overall Comments
- In `useWorkflowGraph`, the `map(([key, value]) => ({ key, value }))` within the `headers/params` branch shadows the outer `key` variable from the enclosing scope, which can be confusing; consider renaming the inner destructured `key` (e.g., `[entryKey, value]`).
- Where you access `vo.key` and `vo.value` when building `itemConfig[key]`, consider defining and using a typed interface for these table rows instead of `any` to make the new `key` property usage type-safe.

Sourcery 对开源项目免费 —— 如果你觉得我们的代码审查有帮助,欢迎分享 ✨
帮我变得更有用!请对每条评论点 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English

Hey - I've left some high level feedback:

  • In useWorkflowGraph, the map(([key, value]) => ({ key, value })) within the headers/params branch shadows the outer key variable from the enclosing scope, which can be confusing; consider renaming the inner destructured key (e.g., [entryKey, value]).
  • Where you access vo.key and vo.value when building itemConfig[key], consider defining and using a typed interface for these table rows instead of any to make the new key property usage type-safe.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `useWorkflowGraph`, the `map(([key, value]) => ({ key, value }))` within the `headers/params` branch shadows the outer `key` variable from the enclosing scope, which can be confusing; consider renaming the inner destructured `key` (e.g., `[entryKey, value]`).
- Where you access `vo.key` and `vo.value` when building `itemConfig[key]`, consider defining and using a typed interface for these table rows instead of `any` to make the new `key` property usage type-safe.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@shuqinzhao shuqinzhao deleted the fix/v0.3.0_zy branch April 14, 2026 07:12
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