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

@route中使用 paramSchema 替代 validateMetaInfo #6

Open
zhang740 opened this issue Dec 4, 2018 · 4 comments
Open

@route中使用 paramSchema 替代 validateMetaInfo #6

zhang740 opened this issue Dec 4, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@zhang740
Copy link
Owner

zhang740 commented Dec 4, 2018

validateMetaInfo 是基于 https://github.com/node-modules/parameter 的实现,后续使用 paramSchema(OpenAPI)规范替代,便于读取详细类型信息

@zhang740 zhang740 added the enhancement New feature or request label Dec 4, 2018
@yuexing0921
Copy link

这个功能什么时候上呀?

@zhang740
Copy link
Owner Author

对于手写来说跟 validateMetaInfo 能力差不多,paramSchema 会考虑配合TS解析入参类型来做
目前支持的是函数返回值解析,入参解析还要等等

@vagusX
Copy link

vagusX commented Mar 2, 2019

@zhang740 刚想问 validateMetaInfo 能不能暴露出来支持自定义校验规则,方便 class-validator 之类库的使用 😁,话说啥时候可以支持呢

@zhang740
Copy link
Owner Author

zhang740 commented Mar 4, 2019

@vagusX 你这个需求好办
可以参照 param.ts 写个中间件
RouteType 上有获取的类型信息,你可以获取到类型然后实例化,然后再把参数对应赋值再validate,你可以试试,等有空给你写个demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants