← 返回起始笔记位置

知识卡片

普通读书笔记卡 · 10296.b.1.c.1.c.4.g · 生成模型:未记录

网关按契约校验流量

理解等级:中级

分发准确的 OpenAPI 到网关,可在统一入口按 schema 检查请求和响应,拦截契约外流量并记录异常。把同样的验证用于与第三方交互也能形成防御层。检查效果取决于契约准确性,字段结构匹配后仍应由业务逻辑校验身份、权限与语义。

在测试阶段可以把同样的对照思想用于[[验证代理复用已有用例]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Automating API Delivery APIOps with OpenAPI》《第 10 章 自定义 Lint 与安全检查》(10.2.12 Validating traffic in the gateway using OpenAPI;来源项目 book-source,extracted/Automating API Delivery APIOps with OpenAPI/_epub-src/OEBPS/Text/chapter-10.xhtml#p179) - 结论依据:原文说明网关按 OpenAPI schema 拦截不合规请求并减少后端负担。 - 原始内容:With an accurate OpenAPI definition document, you can consider providing your definition to your API gateway and using it to validate request traffic before the request reaches your backend microservices. Some API gateways (e.g., Amazon API Gateway, Kong using its OAS Validation plugin [https://mng.bz/v8D7], and Apigee using the OASValidation policy [https://mng.bz/4JEw]) allow you to do this.