tuax / tua-api

🏗 一款可配置的通用 api 请求函数生成工具(A common tool helps converting configs to api functions)

Home Page:https://tuax.github.io/tua-api/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

参数多类型支持

seasidesun opened this issue · comments

你的功能请求是否与某些问题相关?请描述
当某个api的参数过多时,如果只有一个参数是需要对象控制的,那要把所有的参数都改写成对象,这样有点不友好,改动成本有点高

描述您想要的解决方案
能不能两者都支持,类似这样:

[ 
  'userId',
  'date',
  {
    'status':  '0',
  },
  {
    'foo': 1,
  },
  {
    'bar': { required: true },
  }
]

当数组中的对象类型的参数中有多个 key 时,直接抛出错误。

[ 
  'userId',
  {
    'foo': 1,
    'bar': { required: true },
  }
]

描述你考虑过的备选方案
简洁清晰地描述一下你考虑过的其他备选方案,可能会有什么问题。

数组中的对象类型的参数有多个 key,这种方案灵活度太高,容易出问题。

附加上下文
添加一些问题的相关上下文。