YAML 模式验证? [英] YAML Schema Validation?

查看:41
本文介绍了YAML 模式验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有适用于 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 可用于大多数与 RxKwalify.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.

更多有关使用 YAML 和 JSON Schema 的信息(包括工具和编辑器支持)在此页面上进行跟踪.在撰写本文时,Visual Studio Code 中提供了编辑器支持,并且通过 npm 提供了基于命令行的验证工具.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆