知识卡片
Lint引擎影响规则复用
选择引擎时要比对接口格式、规则集兼容和政策语言。Spectral 验证 YAML 与 JSON,可接入多个编辑工具。Vacuum 的例子说明可保留已有 Spectral 规则集。Spego 的例子用 OPA 加 Rego 表达策略,适合已有相应政策体系的团队研究。迁移前应在一批代表性接口上验证原有检查是否一致。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- API Lint 与设计一致性 3.3 Introducing API linters · 查看原书依据
Besides Spectral, the Redocly CLI (https://github.com/Redocly/redocly-cli) has an API linter well known for its easy-to-use OpenAPI file management features. Vacuum (https://github.com/daveshanley/vacuum) is a very fast OpenAPI linter that works with Spectral rulesets. One final tool worth mentioning is Kevin Swiber’s Spego (https://github.com/kevinswiber/spego), which uses the Open Policy Agent (OPA) to validate OpenAPI definitions. In Spego, linting rules are defined in Rego, which is a declarative policy language used by OPA.
参考来源
- 位置:《Automating API Delivery APIOps with OpenAPI》《第 03 章 API Lint 与设计一致性》(3.3 Introducing API linters;来源项目 book-source,extracted/Automating API Delivery APIOps with OpenAPI/_epub-src/OEBPS/Text/chapter-3.xhtml#p33)
- 结论依据:原文对比数种工具及其规则兼容性,特别指出 Vacuum 使用 Spectral 规则集和 Spego 使用 Rego。
- 原始内容:Besides Spectral, the Redocly CLI (https://github.com/Redocly/redocly-cli) has an API linter well known for its easy-to-use OpenAPI file management features. Vacuum (https://github.com/daveshanley/vacuum) is a very fast OpenAPI linter that works with Spectral rulesets. One final tool worth mentioning is Kevin Swiber’s Spego (https://github.com/kevinswiber/spego), which uses the Open Policy Agent (OPA) to validate OpenAPI definitions. In Spego, linting rules are defined in Rego, which is a declarative policy language used by OPA.