Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

泛化调用能支持嵌套规则吗 #917

Open
boringplay opened this issue Apr 25, 2023 · 8 comments
Open

泛化调用能支持嵌套规则吗 #917

boringplay opened this issue Apr 25, 2023 · 8 comments

Comments

@boringplay
Copy link

Is your feature request related to a problem? Please describe.
一些通用的参数定义了一个类型,举个例子

struct Base {
  1: required i64 sid (
    api.query = "sid"
  )
}

struct AReq {
  1: required Base base;
}

http 泛化调用的时候能不能支持这种嵌套的场景。如果参数都平铺出来,参数会比较麻烦

Describe the solution you'd like

Describe alternatives you've considered

Additional context

@joway
Copy link
Member

joway commented Apr 26, 2023

能支持的

@boringplay
Copy link
Author

需要怎么写规则呀?有例子么?

另外 response 的时候 json:"-" 这样能过滤掉某些字段么?

@joway
Copy link
Member

joway commented Apr 27, 2023

@joway
Copy link
Member

joway commented Apr 27, 2023

可以先本地写个简单测试尝试下~

@boringplay
Copy link
Author

这个是指读取 body里 的some[0].id 吧?怎么把 ReqItem的.id和 query 的 id映射 上?

@joway
Copy link
Member

joway commented Apr 28, 2023

@x-end 没太懂你的意思,你要不把请求的 http body json ,以及你希望的 IDL 定义都贴下?

@boringplay
Copy link
Author

body json:

{
  "a": "12",
  "b": "222"
}

idl:

struct Base {
  1: required string a (
    api.query = "a"
  )
}

struct AReq {
  1: required Base base
  2: required string b (api.query = "b")
}

@joway
Copy link
Member

joway commented May 4, 2023

这个不支持的,这个嵌套关系都变了,如果支持的话,不利于长期维护

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants