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
feat: add request-validation plugin #700
Conversation
Signed-off-by: sjcsjc123 <1401189096@qq.com>
Signed-off-by: sjcsjc123 <1401189096@qq.com>
https://github.com/xeipuuv/gojsonschema |
好的 |
@sjcsjc123 那这个PR我先转为draft了 等实现了json schema的解析校验之后再review下 |
采用docker compose的方式来模拟wasm和envoy。 |
@sjcsjc123 建议用petstore的addpet接口来做一下测试:https://petstore.swagger.io/#/pet/addPet |
我理解的是,为e2e框架添加新的测试板块,去构造一个支持携带body的http request请求,发送给wasm插件进行过滤,然后转发给addpet接口判断能否返回200响应是吗? |
@sjcsjc123 e2e框架支持带body测试的工作(#733 )目前正在做,你可以等这个完成再做测试,或者本地先手动测试一下也可以 |
好的,我等 #733 完成 |
Signed-off-by: sjcsjc123 <1401189096@qq.com>
Signed-off-by: sjcsjc123 <1401189096@qq.com>
@johnlanni e2e测试已完善body校验 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: sjcsjc123 <1401189096@qq.com>
Ⅰ. Describe what this PR did
添加request validation的插件
Ⅱ. Does this pull request fix one issue?
fixes: #682
Ⅲ. Why don't you add test cases (unit test/integration test)?
后面补充一下
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
根据个人的理解去改的,没有照搬apisix,类比于apisix添加验证策略方式大致如下:
每个字段的object类型会映射为各自的策略方式,header写法一样,也可添加校验失败返回的code和message