YAML 模式验证? [英] YAML Schema Validation?
问题描述
是否有适用于 YAML 的架构验证语言?我用谷歌搜索,但找不到任何有用的东西.
Is there a schema validation language for YAML? I've googled but couldn't find anything useful.
像 XSD 格式,使用语言本身来描述架构,在我的情况下是最好的选择.
Something like XSD format, using the language itself to describe the schema, would be the best choice in my case.
推荐答案
JSON Schema 可用于大多数与 Rx 或 Kwalify.JSON Schema 是我能够找到 编辑器支持.
JSON Schema can be used with most YAML documents resulting in a more portable and better documented solution than Rx or Kwalify. JSON Schema is the only of the three for which I have been able to find editor support.
More information on using YAML and JSON Schema including tools and editor support is tracked on this page. At the time of writing, there is editor support in Visual Studio Code and a command-line based validation tool available via npm
.
完全披露:我创建了上面链接的网站,以尝试使 JSON Schema 应用于 YAML 更容易被发现.我还为 VS Code 编写了一个编辑器扩展,后来被上面链接的 RedHat 扩展取代.
Full Disclosure: I authored the web site linked above to try to make the application of JSON Schema to YAML more discoverable. I also wrote an editor extension for VS Code that has since been superseded by the RedHat extension linked above.
这篇关于YAML 模式验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!