Skip to content

Conversation

@Spritualkb
Copy link

Description

This PR fixes the plugin parameter validation logic to allow duplicate
parameter names across different locations while maintaining uniqueness within
the same location.

Changes:

  • Update frontend checkSameName function to validate uniqueness only within
    same location
  • Modify backend parameter validation to use location-name as unique keys
  • Enable same parameter names in different locations (Header/Body/Query/Path)
  • Fix 参数名称不能重复 error when parameters share names across locations

What type of PR is this?

fix: A bug fix

Check the PR title.

  • This PR title match the format: <type>(optional scope):
    <description>
  • The description of this PR title is user-oriented and clear enough for
    others to understand.
  • Add documentation if the current PR requires user awareness at the usage
    level.

(Optional) Translate the PR title into Chinese.

fix(plugin): 允许不同位置的参数名称重复

(Optional) More detailed description for this PR(en: English/zh:

Chinese).

en:
Previously, the plugin configuration system prevented users from using the
same parameter name in different locations (e.g., having a "token" parameter
in both request headers and request body). This was overly restrictive and
blocked legitimate use cases.

This PR implements a "location + name" combined validation approach:

  • Frontend: Modified checkSameName function to include location filtering
    (dataItem.name === val && dataItem.location === item.location)
  • Backend: Updated parameter validation to use "location-name" as unique keys
    instead of just parameter names
  • Users can now have parameters with the same name in different locations
    (Header, Body, Query, Path)
  • Validation still prevents true duplicates within the same location

zh(optional):
之前的插件配置系统阻止用户在不同位置使用相同的参数名称(例如在请求头和请求体中
都有"token"参数),这种限制过于严格,阻碍了合理的使用场景。

此PR实现了"位置+名称"联合验证方法:

  • 前端:修改 checkSameName 函数,增加位置过滤(dataItem.name === val && dataItem.location === item.location
  • 后端:更新参数验证逻辑,使用"位置-名称"作为唯一键而不是仅使用参数名称
  • 用户现在可以在不同位置(Header、Body、Query、Path)使用相同的参数名称
  • 验证逻辑仍会阻止同一位置内的真正重复

(Optional) Which issue(s) this PR fixes:

Fixes the "参数名称不能重复" (parameter names cannot be duplicated) error that
incorrectly triggered when users had legitimate use cases requiring the same
parameter name in different request locations.

- Update frontend checkSameName function to validate uniqueness only within same location
- Modify backend parameter validation to use location-name as unique keys
- Enable same parameter names in different locations (Header/Body/Query/Path)
- Fix 参数名称不能重复 error when parameters share names across locations
@CLAassistant
Copy link

CLAassistant commented Sep 14, 2025

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Spritualkb
Copy link
Author

这个线上的扣子空间都有这个限制可以的话线上的也修复一下,我今天想新建一个插件发布啥的都遇到这个bug

@fanlv
Copy link
Collaborator

fanlv commented Sep 15, 2025

cc @mrh997 看看。

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.

3 participants